mitoo
Introduction
mitoo is a Rust toolkit library that encapsulates methods such as configuration reading, file operations, encryption and decryption, transcoding, regular expressions, threading, collections, trees, sqlite, rabbitMQ, etc., and customizes or integrates various Util tool classes.
Module Description
- cmd_util: Command-line execution tool
- conf_util: Configuration file reading tool
- date_util: Date and time tool
- file_util: File operation tool
- ffmpeg_util: Tool encapsulated based on ffmpeg
- log_util: Logging tool
- re_util: Regular expression tool
- secure_util: General encryption and decryption tool, including digest algorithm processing, etc.
- thread_util: Thread tool
- sqlite_util: SQLite database operation tool
- rabbitmq_util: rabbitmq encapsulation for more convenient use
For the specific usage of each module's Util, please refer to the description of each module or the unit test examples within the module (most modules contain unit test examples).
Example 1: Instructions for using conf_util configuration
It supports json and yaml as configurations. Users are assumed to know the content and format of the configurations. For multi-level configurations, data can be directly accessed through the x.y.z.w format. The specific usage is as follows:
Special note: Both objects and arrays are operated directly through dots. For example, obj.children.name where "obj" is an object, "children" is an array, and "name" is an attribute of the objects in "children". When using obj.children.name, it will get the "name" values of all objects in the "children" array.
use YamlWrapper;
Example 2: SQLite database reading
// Note: Two FromSqliteRow are imported here: one is used for annotations, and the other is used in the expanded code.
use ;
use SqliteClient;
// Assume there is a users table; here is the definition of the corresponding struct:
Example 3: RabbitMQ Tool
It is recommended that various configurations be set via yaml, and then read using ConfUtil to pass as parameters.
use RabbitMQUtil;
// Produce data
async
// Consume data
async