Crate mitoo

Crate mitoo 

Source
Expand description

mitoo is a Rust toolkit library that encapsulates methods such as configuration reading, file operations, encryption and decryption, transcoding, regular expressions, and threading, with various custom or integrated Util tool classes.

Yaml configuration reading

use mitoo::YamlWrapper;
 
#[test]
fn test_config_util() {
    // read the configuration file
    let wrapper = YamlWrapper::new("docs/config.yaml").unwrap();
    // Directly convert the YAML string into YamlWrapper
    // let warpper = YamlWrapper::from_string("......").unwrap();
 
    // Whether it is an object or an array, they are directly operated using the . (dot).
    // Here, "address" is an object, "children" is an array, and "name" is an attribute of the objects within the "children" array.
    let x = wrapper.get("address.children.name");
    println!("address.children.name = {:?}", x);
     
    // The get method is used to retrieve an array, while get_one is used to retrieve the first element.
    let x = wrapper.get_one("address.x.y").as_str().unwrap();
    println!("address.x.y = {}", x);
}

Defined macros:

  • mitoo::set
  • mitoo::map

Modules§

macro_util
third

Macros§

map
Create a HashMap
set
Create a HashSet

Structs§

CmdUtil
Command-line tools
CollectionUtil
Collection-related utility classes, such as for intersections, unions, reversal, element removal, etc.
DateUtil
Date tools, including common quick generation functions such as obtaining the current day’s time string, formatting, time string parsing, etc.
EnvUtil
Environment variable utility class
FfmpegUtil
Streaming media-related processing, operated by means of ffmpeg
FileUtil
General file operations, such as reading and writing, directory creation, deletion, etc.
HexUtil
Number system conversion tool
HttpUtil
HTTP tool, which is mainly used as a reference for using reqwest
IdUtil
ID tool, used for generating IDs, including UUID and snowflake algorithm
JsonWrapper
Json configuration reading
LogUtil
Logging utility class
ReUtil
Regular expression tools, such as matching, capturing the first one, capturing all, etc.
SchedulingUtil
Scheduled task utility class
SecureUtil
Encryption and decryption tools, which also include digest algorithms, etc.
StrUtil
String-related operations
ThreadUtil
Thread utility class
TreeNode
Tree node structure
TreeUtil
Tree structure utility class
UrlUtil
URL utility class, for extracting parameters, URL encoding and decoding, etc.
YamlWrapper
Yaml data reading

Enums§

Exception
Encapsulate common exception types
Object
Basic data objects (including Number, String, bool, none, and time)

Traits§

ObjectStorage
Object storage abstraction definition
SqlCrud
Database operation interface definition (conventional CRUD)
TreeData