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[ElementType: Movable]
A node in a linked list data structure.
Parameters
- ElementType (
Movable): The type of element stored in the node.
Fields
- value (
ElementType): The value stored in this node.
Implemented traits
AnyType,
ImplicitlyDeletable,
Movable
Methods
__init__
def __init__(out self, var value: ElementType, prev: Optional[Optional[UnsafePointer[NoneType, MutUntrackedOrigin]]], next: Optional[Optional[UnsafePointer[NoneType, MutUntrackedOrigin]]])
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[UnsafePointer[NoneType, MutUntrackedOrigin]]]): Optional pointer to the previous node. - next (
Optional[Optional[UnsafePointer[NoneType, MutUntrackedOrigin]]]): Optional pointer to the next node.
__del__
def __del__(deinit self) where conforms_to(ElementType, ImplicitlyDeletable)
Destroy the entry's key and value.
Constraints:
ElementType must be ImplicitlyDeletable.
write_to
def write_to(self, mut writer: T) where conforms_to(ElementType, Writable)
Write this node's value to the given writer.
Args:
- writer (
T): The writer to write the value to.