Mojo struct
Node
struct Node[ElementType: Copyable & ImplicitlyDestructible]
A node in a linked list data structure.
Parameters
- ElementType (
Copyable&ImplicitlyDestructible): The type of element stored in the node.
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[NonNullUnsafePointer[NoneType, MutExternalOrigin]]], next: Optional[Optional[NonNullUnsafePointer[NoneType, MutExternalOrigin]]])
Initialize a new Node with the given value and optional prev/next pointers.
Args:
write_to
write_to[_ElementType: Copyable & ImplicitlyDestructible & Writable](self: Node[_ElementType], mut writer: T)
Write this node's value to the given writer.
Parameters:
- _ElementType (
Copyable&ImplicitlyDestructible&Writable): Used to conditionally enable this function if_ElementTypeisWritable.
Args:
- writer (
T): The writer to write the value to.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!