4 个版本 (稳定)
| 1.2.0 | 2023 年 11 月 16 日 | 
|---|---|
| 1.1.0 | 2023 年 8 月 12 日 | 
| 1.0.0 | 2023 年 8 月 12 日 | 
| 0.1.0 | 2021 年 9 月 20 日 | 
#552 in 文件系统
每月 168 次下载
在 2 个 Crates 中使用 (uggo-config)
19KB
380 代码行
config-better-rs
更好地利用目录进行配置/数据/缓存,使其更加友好!
此模块提供了对 XDG Base Directory 规范的支持,以及 Windows、Mac OS 和 Linux 的操作系统友好回退(如果未指定)。
这是同名 Python 版本的移植。
使用方法
use config_better::Config;
fn main() {
    let dirs = Config::new("some-app");
    println!("{:?}", dirs);
    // View paths
    println!("{:?}", dirs.cache);
    println!("{:?}", dirs.config);
    println!("{:?}", dirs.data);
    // Create/delete a single directory
    dirs.cache.create();
    dirs.cache.remove();
    // Create/delete all directories
    dirs.create_all();
    dirs.remove_all();
}
任何目录的 create 和 remove 方法都可以通过 async 功能提供异步对应物。
有关详细信息,请参阅 crates.io 上的安装说明和 docs.rs 上的文档。
MSRV
对于该 Crates 的 sync 和 async 功能,MSRV 是 1.61.0。对于 async-tokio 功能,MSRV 是 1.63.0。
依赖项
~0.3–12MB
~125K SLoC