Index ¦ Archives

Rust

Rust is a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety.

vim main.rs

use ferris_says::say; // from the previous step
use std::io::{stdout, BufWriter};

fn main() {
    let stdout = stdout();
    let message = String::from("Hello fellow Rustaceans!");
    let width = message.chars().count();

    let mut writer = BufWriter::new(stdout.lock());
    say(message.as_bytes(), width, &mut writer).unwrap();
}

Run

cargo run

Rust

© 2000-2018 by Daniel Pimentel (d4n1). Under MIT.