Rust Cargo

Links: 105 Rust Index


  • Start a new project: cargo new project-name
    • Sample project structure
    • attachments/Pasted image 20220515210614.jpg
    • A target folder is created which stores the binary.
  • Run the project: cargo run.
  • Build the project: cargo build.
cargo run and cargo build can be run anywhere inside the project folder.

If you run it outside the project folder you will get this error. error: could not find Cargo.toml in /home/sarthak/learning-rust or any parent directory.


Last updated: 2022-05-15