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