1 unstable release

0.1.0 Jan 9, 2025

#1229 in Algorithms

Download history 102/week @ 2025-01-05 14/week @ 2025-01-12

116 downloads per month

MIT license

4KB
54 lines

Rust

Installation

Step 1 - Install Rust via Terminal

Install Rust via RustUp Package Manager.

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Step 2 - Verify Installation

cargo --version

Commands

Create a new project

cargo new <projectname>

Run a project

cargo run

Run a project without Debug Info

cargo run -q

Step 3 - VSCode

Extensions: rust analyzer

Step 4 - Example

mod point;
use point::Point;

fn main() {
    let p0 = Point::new(0.0, 0.0, 0.0);
    let p1 = Point::new(1.0, 1.0, 1.0);
    println!("Distance: {}", p0.distance(&p1));
    println!("Hello, world!");
}

Step 5 - Publish Create

cargo login
cargo publish

Step 6 - Formatting

rustup component add rustfmt
cargo fmt

No runtime deps