edited on 2020-08-29

Learning Rust

Here is a list of stuff that I've found interesting and important while trying to learn Rust Language.

into_iter, iter and iter_mut

Conditional Compilation for Debug and Release Builds

Here is the way to conditionally compile Rust code for Debug and Release builds

#[cfg(debug_assertions)]
fn example() {
    println!("Debugging enabled");
}

#[cfg(not(debug_assertions))]
fn example() {
    println!("Debugging disabled");
}

fn main() {
    if cfg!(debug_assertions) {
        println!("Debugging enabled");
    } else {
        println!("Debugging disabled");
    }

    #[cfg(debug_assertions)]
    println!("Debugging enabled");

    #[cfg(not(debug_assertions))]
    println!("Debugging disabled");

    example();
}