For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).
Node
struct Node[T: Movable]
A node in a linked list data structure.
Parameters
- T (
Movable): The type of element stored in the node.
Fields
- value (
T): The value stored in this node.
Implemented traits
AnyType,
Deinitable (where conforms_to(T, Deinitable)),
Movable
Methods
__init__
def __init__(out self, var value: T, prev: Optional[Optional[Pointer[Self, MutUntrackedOrigin]]], next: Optional[Optional[Pointer[Self, MutUntrackedOrigin]]])
Initialize a new Node with the given value and optional prev/next pointers.
Args:
- value (
T): The value to store in this node. - prev (
Optional[Optional[Pointer[Self, MutUntrackedOrigin]]]): Optional pointer to the previous node. - next (
Optional[Optional[Pointer[Self, MutUntrackedOrigin]]]): Optional pointer to the next node.
write_to
def write_to(self, mut writer: T) where conforms_to(T, Writable)
Write this node's value to the given writer.
Args:
- writer (
T): The writer to write the value to.