Skip to content

Instantly share code, notes, and snippets.

@ryanc414
Created September 24, 2020 22:36
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 ryanc414/191b7eb1182512bdfb000d9a4d8b9cb8 to your computer and use it in GitHub Desktop.
Save ryanc414/191b7eb1182512bdfb000d9a4d8b9cb8 to your computer and use it in GitHub Desktop.
linked lists in Rust
use std::collections::LinkedList;
fn main() {
let mut list: LinkedList<u32> = LinkedList::new();
list.push_back(2);
list.push_back(3);
list.push_back(5);
list.push_back(7);
list.push_back(11);
let mut vec: Vec<u32> = Vec::new();
for val in list.iter() {
vec.push(val*3);
}
println!("{:?}", vec);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment