gregpaton08 / rust-lang-book

Exercises from the Rust book

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rust-lang-book

Exercises from the Rust book

Cargo

Creating a Project

cargo new <project name>
# e.g.
cargo new my_new_project
cd my_new_project # navigate to new dir where project was created

This will create two files inside my_new_project with the following directory layout:

.
├── Cargo.toml
└── src
    └── main.rs

All source code should go in the src directory. The generated main.rs file contains a simple hello world program.

Cargo.toml will look something like this:

[package]
name = "my_new_project"
version = "0.1.0"
authors = ["Gregory Paton <myEmailAddress@internet.com>"]
edition = "2018"

[dependencies]

Building and Running a Project

# create a debug build
cargo build
./target/debug/my_new_project
# build and run with a single command
cargo run

# create a release build
cargo build --release
./target/release/my_new_project
# build and run with a single command
cargo run --release

About

Exercises from the Rust book


Languages

Language:Rust 100.0%