🦀 เอกสารสอนภาษา Rust สำหรับผู้เริ่มต้น | คำอธิบายภาษาไทย | โค้ดภาษาอังกฤษ
- 📖 20 บทเรียน ครอบคลุมตั้งแต่พื้นฐานถึง Advanced
- 📝 100+ แบบฝึกหัด พร้อมเฉลยละเอียด
- ❓ 100+ Quiz ทดสอบความเข้าใจ
- 📋 Rust Cheatsheet สรุป syntax ครบ
- 🎯 Rust Edition 2024 ทันสมัยที่สุด
เปิด https://premix-kernel.github.io/rust-tutorial
# Clone repository
git clone https://github.com/premix-kernel/rust-tutorial.git
cd rust-tutorial
# ติดตั้ง mdBook (ถ้ายังไม่มี)
cargo install mdbook
# รัน development server
cd docs
mdbook serve
# เปิด http://localhost:3000cd docs
mdbook build
# ไฟล์อยู่ใน docs/book/cd docs
mdbook test
# ตรวจสอบว่า code blocks ถูกต้องก่อน commit# รันตัวอย่างโค้ด
cargo run --example hello_world # บทที่ 1-4
cargo run --example ownership # บทที่ 5
cargo run --example structs_enums # บทที่ 6-7
cargo run --example collections # บทที่ 8
cargo run --example error_handling # บทที่ 9
cargo run --example generics_traits # บทที่ 10
cargo run --example iterators # บทที่ 13
cargo run --example smart_pointers # บทที่ 14
cargo run --example concurrency # บทที่ 15
cargo run --example async_await # บทที่ 16
cargo run --example web_server # บทที่ 19 (http://localhost:3000)| บท | หัวข้อ | คำอธิบาย |
|---|---|---|
| 1 | Getting Started | ติดตั้ง Rust, Hello World, Cargo |
| 2 | Variables | ตัวแปร, Data Types, Mutability |
| 3 | Functions | ฟังก์ชัน, Parameters, Return |
| 4 | Control Flow | if/else, loops, match |
| บท | หัวข้อ | คำอธิบาย |
|---|---|---|
| 5 | Ownership ⭐ | หัวใจของ Rust |
| 6 | Structs | โครงสร้างข้อมูล, Methods |
| 7 | Enums | Pattern Matching, Option |
| 8 | Collections | Vec, String, HashMap |
| 9 | Error Handling | panic!, Result, ? operator |
| บท | หัวข้อ | คำอธิบาย |
|---|---|---|
| 10 | Generics & Traits | Type parameters, Trait bounds |
| 11 | Modules | Packages, Crates, Visibility |
| 12 | Testing | Unit tests, Integration tests |
| 13 | Iterators | Closures, Iterator methods |
| 14 | Smart Pointers | Box, Rc, RefCell, Weak |
| บท | หัวข้อ | คำอธิบาย |
|---|---|---|
| 15 | Concurrency | Threads, Channels, Mutex |
| 16 | Async/Await | Futures, Tokio |
| 17 | Unsafe Rust | Raw pointers, FFI |
| 18 | Macros | Declarative, Procedural |
| บท | หัวข้อ | คำอธิบาย |
|---|---|---|
| 19 | Web Development | Axum, REST API |
| 20 | Final Project | CLI Todo App |
- 📋 Rust Cheatsheet - สรุป syntax ที่ใช้บ่อย
- 🛠️ Cargo Commands - คำสั่ง Cargo ทั้งหมด
- 🔗 Resources - แหล่งเรียนรู้เพิ่มเติม
- ✍️ แบบฝึกหัด - 100+ ข้อพร้อมเฉลย
- ❓ Quiz - ทดสอบความเข้าใจ
- 🆕 ผู้เริ่มต้น - ไม่เคยเขียนโปรแกรมมาก่อน
- 🔄 Developers - มีประสบการณ์ภาษาอื่นอยากเรียน Rust
| เครื่องมือ | คำอธิบาย |
|---|---|
| VS Code + rust-analyzer | Editor ยอดนิยม พร้อม auto-complete |
| RustRover | JetBrains IDE สำหรับ Rust |
| Rust Playground | ทดสอบโค้ดออนไลน์ |
rust-tutorial/
├── .github/
│ └── workflows/
│ └── mdbook.yml # CI/CD
├── docs/
│ ├── book.toml # mdBook config
│ ├── book/ # Built HTML (gitignored)
│ └── src/
│ ├── SUMMARY.md # สารบัญ
│ ├── introduction.md # หน้าแรก
│ ├── ch01-ch20/ # 20 บท
│ └── appendix/ # ภาคผนวก
├── .gitignore
├── Cargo.toml # สำหรับ examples
├── CONTRIBUTING.md
├── LICENSE
└── README.md
ยินดีรับทุกการมีส่วนร่วม! ดู CONTRIBUTING.md สำหรับรายละเอียด
โปรเจกต์นี้อยู่ภายใต้ MIT License
- 📖 The Rust Book
- 🎓 Rust by Example
- 🏋️ Rustlings
- 📦 Crates.io
- 💬 Rust Discord
🦀 Happy Coding with Rust!
Made with ❤️ for Thai Rustaceans