zlsrs/zfile/
mod.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! # zfile 模块
//!
//! 这个模块提供了一系列文件和路径操作的工具函数,是对 Rust 标准库文件操作功能的扩展。
//!
//! ## 主要功能
//!
//! - 路径操作:规范化、转换和验证
//! - 项目目录管理:工作目录、程序目录等
//! - 文件操作:创建、读写、删除等
//!
//! ## 模块组织
//!
//! - `path`: 提供路径相关的操作,包括路径转换、规范化等
//! - `file`: 提供文件操作相关的功能,包括文件的创建、读写、删除等
//!
//! ## 示例
//!
//! ```rust
//! use zlsrs::zfile::{create_dir, write_file, read_file};
//!
//! fn main() -> Result<(), Box<dyn std::error::Error>> {
//!     // 创建目录
//!     create_dir("./tmp/test_dir")?;
//!     
//!     // 写入文件
//!     write_file("./tmp/test_dir/test.txt", "Hello, World!", false)?;
//!     
//!     // 读取文件
//!     let content = read_file("./tmp/test_dir/test.txt")?;
//!     assert_eq!(content, "Hello, World!");
//!     
//!     Ok(())
//! }
//! ```

cfg_feature! {
    "zfile",
    mod path;
    pub use path::*;

    mod file;
    pub use file::*;
}

#[cfg(test)]
mod tests;