https://github.com/squidmin/rust-labs
Rust learning sandbox
https://github.com/squidmin/rust-labs
cargo learning learning-exercises rust
Last synced: 9 months ago
JSON representation
Rust learning sandbox
- Host: GitHub
- URL: https://github.com/squidmin/rust-labs
- Owner: squidmin
- Created: 2024-03-24T02:42:02.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-24T02:42:23.000Z (almost 2 years ago)
- Last Synced: 2025-02-07T13:54:21.894Z (11 months ago)
- Topics: cargo, learning, learning-exercises, rust
- Language: Rust
- Homepage:
- Size: 1000 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# rust-labs
Rust learning sandbox.
## Getting Started
Ensure that Rust is installed on your system:
```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```
Follow the on-screen instructions to complete the installation.
Once installed, restart your terminal and verify the installation by running `rustc --version`.
You should see the version of the Rust compiler.
## Creating a New Rust Project
This project was created by running the command:
```bash
cargo new rust-labs
```
- `Cargo.toml`: The manifest file for Rust. It contains metadata for your project and dependencies.
- `src/main.rs`: The main source file for your project. By default, it contains a simple program that prints "Hello, world!".
## Compiling Rust programs
Rust projects are compiled with Cargo, Rust's package manager and build system.
To compile your project, run the following command in your project directory:
```bash
cargo build --bin binary1
```
```bash
cargo build --bin binary2
```
etc.
Cargo reads the `Cargo.toml` file, downloads the necessary dependencies, and compiles your project.
After successful compilation, Cargo places the executable in the `target/debug` directory.
## Running Rust programs
After compiling your project, you can run it using Cargo:
```bash
cargo run --bin binary1
```
```bash
cargo run --bin binary2
```
etc.
This command compiles your project (if it hasn't been compiled yet) and runs the resulting executable.