GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Home
  • Documentation
  • Laboratory
  • Journal

This view

  • Original page
  • New address

GeezerVison is showing learning-rust.github.io — Learning Rust

Made by a human · Made for a human

Rust Illuminated.
Grasp Quickly.

Rust Programming Language Tutorials for Everyone!

Get Started Contribute
Data and behavior
Structs, Impls and Traits
struct Person {
    name: String,
    company_name: String,
}

impl Person {
    fn new(name: String, company_name: String) -> Self {
        Self { name, company_name }
    }

    fn intro(&self) -> String {
        format!("I'm {} from {}", self.name, self.company_name)
    }
}

trait Greet {
    const PREFIX: &'static str = "Hello";

    fn greet(&self) -> String {
        format!("{}!", String::from(Self::PREFIX))
    }
}
impl Greet for Person {}

fn main() {
    let steve = Person::new("Steve".to_string(), "Apple".to_string());

    println!("{}", steve.greet()); // Hello!
    println!("{}", steve.intro()); // I'm Steve from Apple
}
Functional
Iterators, Filters, and Maps
fn main() {
    let marks = ["10", "20", "30", "0.4", "0.5", "invalid"];

    let sum: i32 = marks
        // Iterate through marks
        .iter()
        // Parse string to float, ignore if invalid
        .filter_map(|&s| s.parse::<f64>().ok())
        // Multiply decimals under 1.0 by 100
        .map(|num| if num < 1.0 { num * 100.0 } else { num })
        // Trace the values
        .inspect(|&val| println!("Parsed: {val}"))
        // Cast float to integer
        .map(|num| num as i32)
        // Aggregate
        .sum();

    println!("Final: {sum}"); // 150
}
Advanced blueprint
Enums, Generics and HashMap
use std::collections::HashMap;

enum Data<K, V> {
    Value(V),
    KeyValue(K, V),
}

fn main() {
    let data = vec![
        Data::KeyValue("Steve", 10),
        Data::Value(20),
        Data::KeyValue("Bill", 30),
        Data::Value(40),
    ];

    let map = data
        .into_iter()
        // Pattern matching and destructuring
        .map(|item| match item {
            Data::KeyValue(k, v) => {
                println!("{k}: {v}");
                (k.to_string(), v)
            }
            Data::Value(v) => {
                println!("unknown: {v}");
                ("unknown".to_string(), v)
            }
        })
        // Accumulate items into a map
        .fold(HashMap::new(), |mut map, (key, value)| {
            map.entry(key)
                .and_modify(|existing| *existing += value)
                .or_insert(value);
            map
        });

    println!("Map: {:?}", map); // Map: {"unknown": 60, "Bill": 30, "Steve": 10}
}

This is greathttps://t.co/MFtW0NqjEW

— Steven (@sepease) April 5, 2018

After almost 1 month in Rust I think https://t.co/SokezsRqb2 is the the most practical intro to Rust for an experience developer #rust #oh #my

— Filippos Vasilakis (@vasilakisfil) September 6, 2019

If you want to learn #rustlang this great guide is for you https://t.co/6y6q4fPuH0

Compact, focused on the important parts and differences to other programming languages.

— Max Strübing (@mxstrbng) May 22, 2019

よさそう https://t.co/GAtwoNMeVU

— yoshih (@_yoshih_) March 16, 2018

I really liked https://t.co/ZeRH17ep8C and found it much more approachable to start with than the rust-lang book. Includes Cargo basics and goes a little deeper than the learn x in y tutorial which was helpful for rust-specific concepts

— Factory Reset Me, Daddy 😖 (@das867) September 29, 2022

Learn Rust for Freehttps://t.co/EOI2ZbQE0N

— cyberjobmentor (@cyberjobmentor) June 25, 2022

Learning Rust used to mean juggling bad tutorials.https://t.co/OlEazdbf95 consolidates the best paths in one place:
- Curated lessons from beginner to advanced
- Free, open, no signup
- Community maintained roadmap
The Rust tutorial site I wish I had.https://t.co/1wzVn7aTzc

— Bryan (@so_sthbryan) August 8, 2026

This one resource I can get on the matter: https://t.co/aKQDdXiUz5

— hēyyrūdyy404 🕉 滅 (@heyyrudyy404) April 28, 2020

Pra quem quer aprender Rust: https://t.co/R27JA0NWIZ

— Gabs Ferreira (@o_gabsferreira) March 16, 2018

The world’s fastest framework for building websites.

Fully static search library that aims to perform well on large sites.

Modern & modular technical documentation and blog setup.

Help us to improve the documentation.

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.