Skip to content

t4sk/hello-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Mar 8, 2025
0ea7898 · Mar 8, 2025
Jan 15, 2025
Mar 8, 2025
Aug 18, 2024
Dec 23, 2024
Mar 8, 2025

Repository files navigation

Hello Rust

Install

Play ground

Rust book

Rust by example

Rust reference

# Verify installation
rustc --version
cargo --version

# Run
cargo run --bin hello

# Cloning this repo
git clone [email protected]:t4sk/hello-rust.git
cd hello-rust
cargo build

Intro

Data

  • Variable
    • Immutable by default
    • let
    • mut
    • Constant
    • Shadowing
    • Type placeholder _
  • Scalar types
    • i32, u32, f32, bool, char
    • Type conversion
    • Min and max value
    • Integer overflow
  • Compound data types
    • Tuple
      • Destructure, _
      • Empty tuple
      • Nested
    • Array
      • Array - collection of elements with length known at compile time
        • Fill
      • Slice - collection of elements with length not known at compile time
  • String
    • r#
    • usize
    • format!
  • Enum
    • Option
    • Result
    • derive(Debug, PartialEq)
  • Struct
    • Update syntax
    • Struct method (impl)
      • Self, self
      • Associated function (static method)
      • Methods (functions called on a particular instance of type)
  • Operators
    • Math
    • Bool
    • Comparison
    • Bitwise

Control flow

Function

  • function
    • no return value
    • return value
    • implicit return
  • mod
    • visibility, pub
    • use, super
    • nested
    • struct
    • crate

Error handling

Ownership

  • ownership
    • stack and heap
      • stack (last in, first out)
        • store data with known fixed size
      • heap
        • vec (stack = vec pointer, data = heap)
    • Each value in Rust has an owner.
    • There can only be one owner at a time. (Transfer of ownership for variable assignment)
    • When the owner goes out of scope, the value will be dropped.
  • borrow

Standard collections

Trait

Generic types

Closure

Smart pointers

Concurrency

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages