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_wordsubdirectory. - 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_namewill usually make a new directoryproject_nameand initialize it as a git-repository.- But this will not happen if the upper
directory in which
cargois run is itself a git-repository. - Anyway, in
project_name/src/main.rswill be the standard hello-world programe.
- But this will not happen if the upper
directory in which
- Inside the
project_namedirectory, runningcargo buildwill build the project.- The executable will be
target/debug/program_name.
- The executable will be
- Inside
project_name, runningcargo runwill (if necessary) build and (always) executetarget/debug/program_name. cargo checkis faster thancargo buildand verifies that build will work but does not generate an executable.cargo build --releasebuild the release-version instead of the debug-version.