dev_tool/lib.rs
1//! dev-tool 是一个Rust工具包类库,对配置读取、文件操作、加解密、转码、正则、线程等方法进行封装,自定义或集成各种Util工具类。
2//!
3//! Yaml 配置读取
4//! ```rust
5//! use dev_tool::YamlWrapper;
6//!
7//! #[test]
8//! fn test_config_util() {
9//! // 读取配置文件
10//! let wrapper = YamlWrapper::new("docs/config.yaml").unwrap();
11//! // 直接将yaml字符串转换成YamlWrapper
12//! // let warpper = YamlWrapper::from_string("......").unwrap();
13//!
14//! // 不管是对象,还是数组,都是直接通过`.`操作。address是对象,children是数组,name是children中对象的一个属性
15//! let x = wrapper.get("address.children.name");
16//! println!("address.children.name = {:?}", x);
17//!
18//! // get方法是获取数组,而get_one获取的是第一个元素
19//! let x = wrapper.get_one("address.x.y").as_str().unwrap();
20//! println!("address.x.y = {}", x);
21//! }
22//! ```
23//!
24//! 定义的宏:
25//!
26//! - dev_tool::set
27//! - dev_tool::map
28//!
29mod conf_util;
30mod conf_util_yaml;
31mod date_util;
32mod file_util;
33mod hex_util;
34mod http_util;
35mod io_util;
36mod log_util;
37mod re_util;
38mod secure_util;
39mod thread_util;
40mod id_util;
41mod str_util;
42mod collection_util;
43mod scheduling_util;
44pub mod sqlite_util;
45pub mod macro_util;
46/// 第三方crate,将部分简单依赖,直接拷贝到该模块中,减少项目在引入依赖时的版本冲突
47pub mod third;
48
49pub use date_util::DateUtil;
50pub use hex_util::HexUtil;
51pub use file_util::FileUtil;
52pub use re_util::ReUtil;
53pub use secure_util::SecureUtil;
54pub use id_util::IdUtil;
55pub use str_util::StrUtil;
56pub use conf_util::JsonWrapper;
57pub use conf_util_yaml::YamlWrapper;
58pub use collection_util::CollectionUtil;
59pub use scheduling_util::SchedulingUtil;