refactor: Add comprehensive documentation with examples to charging-engine modules

- Add module-level documentation to lib.rs with usage example
- Document Claims and AuthConfig structs with examples in auth.rs
- Add ChargingEngine struct documentation with initialization example
- Document ChargingRule, SubscriberAccount, AccountStatus, UsageEvent, UsageType, and RatingPlan with examples in types.rs
- Add CircuitState, CircuitBreakerError, and CircuitBreaker documentation with examples in circuit_breaker.rs
This commit is contained in:
nutcas3
2026-04-29 04:36:40 +03:00
parent 8fddb29716
commit ccb2ab7ee8
5 changed files with 231 additions and 0 deletions
+34
View File
@@ -1,3 +1,37 @@
//! # Charging Engine
//!
//! A high-performance telecom charging engine for real-time usage-based billing.
//!
//! ## Features
//!
//! - Real-time rating and billing
//! - Circuit breaker for fault tolerance
//! - Rate limiting for API protection
//! - Comprehensive monitoring and metrics
//!
//! ## Example
//!
//! ```rust,no_run
//! use charging_engine::ChargingEngine;
//! use charging_engine::charging::types::UsageEvent;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let engine = ChargingEngine::new("redis://localhost").await?;
//!
//! let event = UsageEvent {
//! imsi: "1234567890".to_string(),
//! volume: 1000,
//! timestamp: chrono::Utc::now(),
//! };
//!
//! let cost = engine.calculate_cost(&event).await?;
//! println!("Cost: {}", cost);
//!
//! Ok(())
//! }
//! ```
pub mod auth;
pub mod charging;
pub mod circuit_breaker;