# 创建一个Candid接口描述文件

除了dfx.json配置文件之外，您还需要一个Candid接口描述文件（例如，my\_rust\_program.did），以映射程序输入参数和返回值格式到Candid中伪代码表现形式。

添加Candid接口描述文件：

1. 如有必要，用pwd命令来检查您是否仍在项目目录下。
2. 在项目的src目录下创建一个新的Candid接口描述文件（例如my\_rust\_program.did）
3. 在文本编辑器中打开这个描述文件并且为程序中每一个函数添加描述。

例如，如果my\_rust\_program是一个简单的计数器程序，使用increment, read和write函数，my\_rust\_program.did看起来是这样的：

```
service : {
 "increment": () -> ();
 "read": () -> (nat) query;
 "write": (nat) -> ();
}
```


---

# 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://mixdao.gitbook.io/dfinity/san-shou-ba-shou/4.-shi-yong-bu-tong-yu-yan-kai-fa/shi-yong-rust/chuang-jian-yi-ge-candid-jie-kou-miao-shu-wen-jian.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.
