Skip to content

Instantly share code, notes, and snippets.

@frgomes
Created April 7, 2021 10:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frgomes/46d60e1da1d76df878323467a9930a8e to your computer and use it in GitHub Desktop.
Save frgomes/46d60e1da1d76df878323467a9930a8e to your computer and use it in GitHub Desktop.
Rust - LinkedList and DoubleLinkedList
mod LinkedList {
type Link<T> = Option<Box<Node<T>>>;
struct Node<T> {
value: T,
next: Link<T>,
}
}
mod DoubleLinkedList {
use core::cell::RefCell;
use std::rc::Rc;
type Link<T> = Option<Rc<RefCell<Node<T>>>>;
struct Node<T> {
value: T,
prev: Link<T>,
next: Link<T>,
}
}
fn main() {
println!("It compiles!");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment