# 快速开始

## 安装Rust

如果您还没有安装Rust，请先按照[官方指南](https://www.rust-lang.org/tools/install)进行安装。

安装完成后，可以通过以下命令验证安装：

```bash
rustc --version
cargo --version
```

## 创建第一个应用

1. 创建一个新的Rust项目：

```bash
cargo new my-app
cd my-app
```

2. 在项目目录中安装Silent：

```bash
cargo add silent
```

3. 在`Cargo.toml`中会自动添加依赖：

```toml
[dependencies]
silent = "2.1.0"
tokio = { version = "1.0", features = ["full"] }
tracing = "0.1"
tracing-subscriber = "0.3"
```

4. 在`src/main.rs`中编写代码：

```rust
use silent::prelude::*;
use tracing::Level;

#[tokio::main]
async fn main() {
    // 初始化日志系统
    tracing_subscriber::fmt()
        .with_max_level(Level::INFO)
        .init();
    
    // 创建路由并定义处理函数
    let route = Route::new("")
        .get(|_req| async { Ok("Hello, World!") });
    
    // 启动服务器
    let server = Server::new();
    println!("Server running at http://127.0.0.1:8000");
    server.run(route).await;
}
```

## 运行应用

```bash
cargo run
```

打开浏览器访问 <http://127.0.0.1:8000> 即可看到"Hello, world!"的响应。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://silent.smart7.tech/quickstart.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
