yimi_rutool/
lib.rs

1// Allow some less critical clippy lints for better development experience
2#![allow(clippy::missing_errors_doc)]
3#![allow(clippy::missing_panics_doc)]
4#![allow(clippy::module_name_repetitions)]
5
6//! # yimi-rutool - A Comprehensive Rust Utility Library
7//!
8//! yimi-rutool is a comprehensive Rust utility library inspired by Hutool,
9//! providing a rich set of tools for everyday development tasks.
10//!
11//! ## Features
12//!
13//! - **Core utilities**: String manipulation, date/time handling, type conversion
14//! - **Cryptography**: Symmetric/asymmetric encryption, hashing, digital signatures
15//! - **HTTP client**: Easy-to-use HTTP client with async support
16//! - **JSON processing**: Fast JSON serialization/deserialization
17//! - **Database**: Database operations and connection management
18//! - **Caching**: In-memory and persistent caching solutions
19//! - **Scheduling**: Cron-based task scheduling
20//! - **Extra tools**: QR code generation, image processing, compression
21//!
22//! ## Usage
23//!
24//! Add this to your `Cargo.toml`:
25//!
26//! ```toml
27//! [dependencies]
28//! rutool = "0.1"
29//! ```
30//!
31//! ## Example
32//!
33//! ```rust
34//! use yimi_rutool::core::{StrUtil, DateUtil};
35//!
36//! // String utilities
37//! let result = StrUtil::is_blank("   ");
38//! assert_eq!(result, true);
39//!
40//! // Date utilities
41//! let now = DateUtil::now();
42//! println!("Current time: {}", now);
43//! ```
44//!
45//! ## Feature Flags
46//!
47//! - `core`: Core utility functions (enabled by default)
48//! - `crypto`: Cryptography functions
49//! - `http`: HTTP client functionality
50//! - `json`: JSON processing
51//! - `cache`: Caching functionality
52//! - `db`: Database operations
53//! - `cron`: Task scheduling
54//! - `extra`: Additional utilities
55//! - `full`: Enable all features (default)
56//!
57//! ## License
58//!
59//! This project is licensed under MIT OR Apache-2.0.
60
61#![cfg_attr(docsrs, feature(doc_cfg))]
62#![warn(missing_docs, clippy::all, clippy::pedantic)]
63#![allow(clippy::module_name_repetitions, clippy::must_use_candidate)]
64
65/// Core utility modules
66#[cfg(feature = "core")]
67pub mod core;
68
69/// Cryptography utilities
70#[cfg(feature = "crypto")]
71pub mod crypto;
72
73/// HTTP client utilities
74#[cfg(feature = "http")]
75pub mod http;
76
77/// JSON processing utilities
78#[cfg(feature = "json")]
79pub mod json;
80
81/// Database utilities
82#[cfg(feature = "db")]
83pub mod db;
84
85/// Caching utilities
86#[cfg(feature = "cache")]
87pub mod cache;
88
89/// Cron scheduling utilities
90#[cfg(feature = "cron")]
91pub mod cron;
92
93/// Extra utilities (QR codes, images, compression, etc.)
94#[cfg(feature = "extra")]
95pub mod extra;
96
97/// JWT (JSON Web Token) utilities
98#[cfg(feature = "jwt")]
99pub mod jwt;
100
101/// Algorithm implementations (bloom filters, etc.)
102#[cfg(feature = "algorithms")]
103pub mod algorithms;
104
105/// Text processing utilities (sensitive word filtering, etc.)
106#[cfg(feature = "text")]
107pub mod text;
108
109/// Error types used throughout the library
110pub mod error;
111
112/// Re-export commonly used types for convenience
113pub use error::{Error, Result};
114
115/// Version information
116pub const VERSION: &str = env!("CARGO_PKG_VERSION");
117
118#[cfg(test)]
119mod tests {
120    use super::*;
121
122    #[test]
123    fn test_version() {
124        assert!(!VERSION.is_empty());
125    }
126}