Update: tài liệu dễ đọc hơn: http://rust-lang.github.io/book/
Rust thuộc loại ngôn ngữ nào?
Rust là một sản phẩm xuất phát từ Mozilla - tổ chức đứng sau Firefox thần thánh.
Rust is a systems programming language focused on three goals: safety, speed, and concurrency.
Vậy đừng lôi Rust ra làm web rồi chê này kia. Những lĩnh vực mà Rust quảng cáo là phù hợp:
- embedding in other languages
- programs with specific space and time requirements
- and writing low-level code like device drivers and operating systems.
Cài đăt: https://www.rust-lang.org/en-US/downloads.html
Kiểm tra version:
$ rustc --versionNhững người code Rust được gọi là : Rustaceans
rustc 1.12.1 (d4f39402a 2016-10-19)
File code Rust có đuôi ".rs". Tên dùng dấu ``_`` để phân cách giữa các từ, như hello_world.rs
$ cat main.rsRust là compiled language, tức phải "build" từ file source ".rs" thành file binary, sau đó chạy file binary.
fn main() {
println!("Hello, FAMILUG!");
}
$ rustc main.rs
$ ./main
Hello, FAMILUG!
Everything is a tradeoff in language design.