Skip to main content
Version: 1.0

Node

struct Node[ElementType: Copyable & ImplicitlyDestructible]

A node in a linked list data structure.

Parameters

Fields

  • value (ElementType): The value stored in this node.

Implemented traits

AnyType, Copyable, ImplicitlyDestructible, Movable

Methods

__init__

__init__(out self, var value: ElementType, prev: Optional[Optional[UnsafePointer[NoneType, MutExternalOrigin]]], next: Optional[Optional[UnsafePointer[NoneType, MutExternalOrigin]]])

Initialize a new Node with the given value and optional prev/next pointers.

Args:

  • value (ElementType): The value to store in this node.
  • prev (Optional): Optional pointer to the previous node.
  • next (Optional): Optional pointer to the next node.

write_to

write_to(self, mut writer: T) where conforms_to(ElementType, AnyType & ImplicitlyDestructible & Writable)

Write this node's value to the given writer.

Args:

  • writer (T): The writer to write the value to.