Skip to content

Instantly share code, notes, and snippets.

View yj7o5's full-sized avatar
💻
Living on the Edge

Yawar Jamal yj7o5

💻
Living on the Edge
View GitHub Profile
@yj7o5
yj7o5 / rust-post-8.rs
Last active March 20, 2019 03:44
A classic iterative fibonacci generator
fn fibonacci_sequence(n: usize) -> u32 {
If n < 0 {
panic!("{} is less than 0", n);
}
let mut x = vec![1, 1];
for i in 2..n {
let next_x = x[i - 1] + x[i - 2];
x.push(next_x)
}
x[x.len()-1]
(lldb) b [my_func_name_for_debugging]
$ (lldb) settings set -- target.run-args “arg1” ...
$ sudo rust-lldb target/debug/deps/[your_program_exe] [arg1] [arg2] … [argN]
$ sudo rust-lldb target/debug/deps/[your_program_exe]
#[test]
fn it_works() {
assert!(false)
}
#[cfg(test)]
mod tests {
 #[test]
 fn it_works() {
 }
}
cargo new myFirstTest && cd myFirstTest