Created
September 24, 2020 22:36
-
-
Save ryanc414/191b7eb1182512bdfb000d9a4d8b9cb8 to your computer and use it in GitHub Desktop.
linked lists in Rust
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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