Skip to content

tipogi/rust.sandbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Sandbox

Rust cover

In this repository, you can find some steps to start learning Rust languague. Mostly, it uses youtube platform playlist to get the knowledge but also can be some useful portals

What is Rust?

  • systems programing language which meant for low-level software, OS, web-browsers, foundational software... Sometimes is also good option to build high-level software but is focused in low-level.
  • Sometimes might be difficult because we have to care about low-level details.
  • Statically typed programing language. Rust compiler will infer all of the types of the args, binding, ...
  • It is not object oriented program language, there is nothing like classes. In rust usually are structs

Create project

cargo new [project-name]

.toml is the manifest file of the project

Like in all binary files, the main function is main function

Commands

  • typecheck: cargo check. It does not create the binary
  • Create the binari: First, it does type check after, build the binary file: cargo build
  • Release binary: cargo build --release
  • Run the binary: It builds the binary and after runs the binary. cargo run
  • To check the trace of the error: RUST_BACKTRACE=1 cargo run
  • Test library with output: cargo test -- --show-output

Visual Studio Code Plugins

  • rust-analyzer: Rust language server

File system

  • target: All the build artifact are there, including, end binary
    • debug: we will find our end binary. In the case of ryan-levick/kvstore, the binary will be kvstore
    • release: Create a release binary
  • Cargo.lock: It explains to cargo the lock versions of the dependencies

Environment

  • env: usually heavier files because it has debug files
  • release: lighter because the compiler does not do as many optimisation

Ownership Rules

  • Each value in Rust has a variable that's called its owner
  • There can only be one owner at a time
  • When the owner goes out of scope, the value will be dropped

References

  • At any given time, we can have either one mutable reference or any number of immutable references
  • References must always be valid

Sources

Videos

Channels

Databases

  • SurrealDB: It is the ultimate cloud database for tomorrow's applications

Books

  • Rust for Rustaceans: by Jon Gjengset
  • Programming Rust: Fast, Safe Systems Development by Jason Orendorff, Jim Blandy, and Leonora F.S. Tindall
  • The Rust Programming Language by Steve Klabnik and Carol Nichols

About

🦀 Rust playground for a beginner

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages