Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Project Overview

Todo CLI App

สร้าง command-line todo app ที่มี features:

$ todo add "Learn Rust"
✅ Added: Learn Rust

$ todo list
1. [ ] Learn Rust
2. [x] Read the book

$ todo complete 1
✅ Completed: Learn Rust

$ todo remove 1
✅ Removed: Learn Rust

🏗️ Project Architecture

+-------------------------------------------------------------------+
|                    Todo CLI App Architecture                      |
+-------------------------------------------------------------------+
|                                                                   |
|   +---------------------------------------------------------------+
|   |                     main.rs (Entry Point)                     |
|   |  * Parse command-line arguments                               |
|   |  * Route to appropriate handler                               |
|   +-------------------------------+-------------------------------+
|                                   |                               |
|           +-----------------------+-----------------------+       |
|           |                       |                       |       |
|           v                       v                       v       |
|   +------------+           +------------+           +------------+|
|   |   todo.rs  |           | storage.rs |           |   cli.rs   ||
|   |  (Model)   |           |   (I/O)    |           | (Interface)||
|   |            |           |            |           |            ||
|   | struct Todo|           | load/save  |           | add, list  ||
|   | enum Status|           | JSON file  |           | complete   ||
|   +------------+           +------------+           +------------+|
|                                   |                               |
|                                   v                               |
|                             todos.json                            |
|                                                                   |
+-------------------------------------------------------------------+

ความรู้ที่ใช้

บทความรู้
2Variables & Types
5Ownership
6Structs
7Enums
8Collections (Vec)
9Error Handling
11Modules

Dependencies

[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

👉 ต่อไป: การออกแบบ