Skip to content
programming languages for all
GitHub

Rust

fn main() {
    println!("Hello, world!");
}
use std::io;

fn factorial(num: u64) -> u64 {
    match num {
        0 | 1 => 1,
        _ => factorial(num - 1) * num,
    }
}

fn main() {
    let mut user_input = String::new();

    println!("enter a number:");
    match io::stdin().read_line(&mut user_input) {
        Ok(_) => (),
        Err(_e) => {
            println!("error: {}", _e);
            return;
        }
    };
    let num: u64 = match user_input.trim().parse::<u64>() {
        Ok(n) => n,
        Err(_e) => {
            println!("'{}' is not a valid positive integer, full error: {}", user_input, _e);
            return;
        }
    };

    if n > 65 {
        println!("cannot compute more than fact(65)");
        return;
    }

    println!("{}", factorial(num));
}

공식 문서

RustRust A language empowering everyone to build reliable and efficient software.

Rust를 쓰는 곳은 매우 많다

개발 환경 구축

튜토리얼

Learn Rust in 15 MinutesRust is a programming language developed by Mozilla Research.
Easy RustRust is a new language that already has good textbooks. But sometimes its textbooks are difficult because they are for native English speakers.
The Rust Programming Language 2판 한국어 번역It wasn’t always so clear, but the Rust programming language is fundamentally about empowerment
Rust By Example 한국어 번역Rust is a modern systems programming language focusing on safety, speed, and concurrency.
Github - rust-lang/rustlings🦀 Small exercises to get you used to reading and writing Rust code!
Exercism Rust 트랙Rust is a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety.
한 줄 한 줄 짜면서 익히는 러스트 프로그래밍러스트로 하는 시스템 프로그래밍에 대한 실무형 안내서이다. 문법과 구조를 넘어 실세계에서 사용되는 사례를 제공한다.
Programming Rust, 2nd EditionSystems programming provides the foundation for the world's computation.
The Rust ReferenceThis book is the primary reference for the Rust programming language.

에디터, LSP

rust analyzerBringing a great IDE experience to the Rust programming language.

패키지 매니저 cargo

The Cargo BookCargo is the Rust package manager.

테스트 cargo test

The Rust Programming Language - 11. 테스팅러스트의 타입 시스템은 이 짐의 큰 부분을 짊어지고 있지만, 타입 시스템이 모든 종류의 부정확성을 잡아낼 수는 없습니다.
#[cfg(test)]
mod tests {
    #[test]
    fn it_works() {
        assert_eq!(2 + 2, 4);
    }
}

포매터 cargo fmt

린트 clippy

Github - rust-lang/rust-clippyA bunch of lints to catch common mistakes and improve your Rust code.