Expand description
Node for representing values in a [SinglyLinkedList].
Next Node within the [SinglyLinkedList].
Creates a new Node with the coresponding value and a Nonein the next field.
let node = Node::new("New Node");
assert_eq!(node.next, None);
assert_eq!(node.value, "New Node");
Converts the Node into a Box-ed version of the Node.
let boxed_node = Node::new(5).into_box();
assert_eq!(boxed_node, Box::new(Node::new(5)));
Converts the Node into a Box, then converts the Box into a NonNull of the Node.
let ptr = Node::new(5).into_non_null();
let value = unsafe { &ptr.as_ref().value };
assert_eq!(value, &5);
- Converts the
Node into a Box before NonNull conversion, ptr should always be valid.
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used
by ==. Read more
This method tests for !=.
impl<T> Any for T where
T: 'static + ?Sized,
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
impl<T, U> Into<U> for T where
U: From<T>,
The type returned in the event of a conversion error.
The type returned in the event of a conversion error.