Skip to main content

rust_ten_commandments/
lib.rs

1pub const TEN_COMMANDMENTS: &str = r#"
2# THE TEN COMMANDMENTS OF RUST šŸ¦€
3
41. Thou shalt paint thy house, thy editor, thy terminal, and thy very soul the royal orange of Rust.
52. Every machine shall run on Rust. Every line of code shall be rewritten in Rust. Legacy languages are an abomination.
63. Thou shalt consume no breakfast, no coffee, no existential dread without a sacred dose of `cargo run`.
74. Thou shalt have no other languages before Rust. JavaScript, Python, C++ — all false idols.
85. Thou shalt own thy data. Thou shalt borrow, but never steal. The borrow checker is thy God; question it not.
96. Thou shalt not use `unsafe` unless it is written in the ancient scrolls of `std::ptr`. And even then, repent.
107. Honor thy Cargo.toml and thy crates.io, that thy dependencies may be many and thy builds fast.
118. Thou shalt fear no data races, for Rust hath given thee fearless concurrency.
129. Thou shalt embrace lifetimes, that thy references may live long and prosper without dangling in the void.
1310. When the compilation succeedeth, thou shalt rejoice with `println!("It works! šŸ¦€")`. And when it faileth, thou shalt rage but learn, for the error messages are holy.
14
15Thus spake the Crab.
16So it is written. So it shall be compiled.
17// From this day forth, everything is Rust.
18// Even this message.
19"#;
20
21pub fn print_commandments() {
22    println!("Hear ye, O programmers of the world!\n");
23    // Remove the title only if you want — or keep it
24    println!("{}", TEN_COMMANDMENTS.trim_start_matches("# THE TEN COMMANDMENTS OF RUST šŸ¦€\n"));
25}
26
27pub fn write_commandments_to_file() -> std::io::Result<()> {
28    use std::fs;
29    let filename = "TEN_COMMANDMENTS.md";
30    fs::write(filename, TEN_COMMANDMENTS)?;
31    println!("\nāœ… The Ten Commandments have been inscribed into ./{filename}");
32    println!("Praise be to the Crab. Thou mayest now begin coding in peace. šŸ¦€");
33    Ok(())
34}