2025-04-25

  • Replaced Arch's rust-package with Arch's rustup package in WSL on home-laptop.

  • Started (again) on The Rust Programming Language.

  • https://gitlab.com/tevaughan/learning-rust
  • Made hello_word subdirectory.
  • What looks like function-call but with function-name terminating in '!' is a macro call, such as
    println!("Hello, world!");
    
  • But I do not know what "macro call" means in rust.
    • For now, book suggests that knowing that a call is a macro is good because a real function obeys rules, and a macro might not obey those rules.
  • Running cargo new project_name will usually make a new directory project_name and initialize it as a git-repository.
    • But this will not happen if the upper directory in which cargo is run is itself a git-repository.
    • Anyway, in project_name/src/main.rs will be the standard hello-world programe.
  • Inside the project_name directory, running cargo build will build the project.
    • The executable will be target/debug/program_name.
  • Inside project_name, running cargo run will (if necessary) build and (always) execute target/debug/program_name.
  • cargo check is faster than cargo build and verifies that build will work but does not generate an executable.
  • cargo build --release build the release-version instead of the debug-version.