5 个版本
新 0.2.3 | 2024 年 8 月 21 日 |
---|---|
0.2.2 | 2024 年 7 月 27 日 |
0.2.1 | 2024 年 6 月 6 日 |
0.2.0 | 2024 年 5 月 29 日 |
0.0.1 | 2024 年 5 月 9 日 |
#228 在 机器人
165 每月下载
用于 4 个包
13KB
178 行
⚠️ 警告 ⚠️
此包仅供 DiMAS 内部使用。
lib.rs
:
配置数据。
可以使用 json5 格式的文件定义智能体配置。提供了一组用于预定义文件名的读取方法。您可以在这里找到一些示例文件。
示例
// create a configuration from a file named `default.json5`
// located in one of the directories listed below.
// If that file does not exist, a default config will be created
let config = Config::default();
// use file named `filename.json5`
// returns an error if file does not exist or is no valid configuration file
let config = Config::from_file("filename.json5")?;
// methods with predefined filenames working like Config::from_file(...)
let config = Config::local()?; // use file named `local.json5`
let config = Config::peer()?; // use file named `peer.json5`
let config = Config::client()?; // use file named `client.json5`
let config = Config::router()?; // use file named `router.json5`
使用文件的方法将在以下目录中搜索文件(顺序从先到后)
- 当前工作目录
.config
目录位于当前工作目录下.config
目录位于主目录下- 本地配置目录(
Linux
:$XDG_CONFIG_HOME
或$HOME/.config
|Windows
:{FOLDERID_LocalAppData}
|MacOS
:$HOME/Library/Application Support
) - 配置目录(
Linux
:$XDG_CONFIG_HOME
或$HOME/.config
|Windows
:{FOLDERID_RoamingAppData}
|MacOS
:$HOME/Library/Application Support
)
依赖关系
~27–40MB
~627K SLoC