Doubly-linked list/Element insertion: Difference between revisions

Content added Content deleted
Line 953: Line 953:
This expands upon the implementation defined in [[Doubly-linked list/Element definition#Rust]] and consists of the relevant lines from the LinkedList implementation in the Rust standard library.
This expands upon the implementation defined in [[Doubly-linked list/Element definition#Rust]] and consists of the relevant lines from the LinkedList implementation in the Rust standard library.


<lang rust>struct Node<T> {
<lang rust>impl<T> Node<T> {
next: Link<T>,
prev: Rawlink<Node<T>>,
value: T,
}

impl<T> Node<T> {
fn new(v: T) -> Node<T> {
fn new(v: T) -> Node<T> {
Node {value: v, next: None, prev: Rawlink::none()}
Node {value: v, next: None, prev: Rawlink::none()}