1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//! [](./LICENSE)
//! [](https://crates.io/crates/cdumay_context)
//! [](https://docs.rs/cdumay_context)
//! [](https://github.com/cdumay/cdumay_context)
//!
//! A flexible context management library that provides a trait-based approach for handling
//! key-value data with support for multiple serialization formats.
//!
//! # Features
//!
//! - Generic context management through the `Contextualize` trait and a `Context` struct
//! - Support for multiple serialization formats (with feature flags):
//! - JSON (feature: "json")
//! - TOML (feature: "toml")
//! - YAML (feature: "yaml")
//! - Type-safe error handling with the `cdumay_core::Error` struct
//!
//! # Example Usage
//!
//! ```rust
//! use std::collections::BTreeMap;
//! use serde::{Serialize, Deserialize};
//! use cdumay_context::{Contextualize, Context};
//!
//! // Basic usage
//! let mut ctx = Context::new();
//! ctx.insert("name".to_string(), serde_value::Value::String("Alice".to_string()));
//!
//! ```
//!
//! # Error Handling
//!
//! The library provides a comprehensive error handling system through the `Error` enum:
//!
//! ```rust
//! use cdumay_context::{Context, ContextDump, Contextualize, UnExpectedError};
//! use rand::Rng;
//! use serde::{Serialize, Deserialize};
//! use std::collections::BTreeMap;
//!
//! fn example_error_handling() -> cdumay_core::Result<()> {
//! let mut rng = rand::rng();
//! let dice_roll: u8 = rng.random_range(1..=6);
//! let mut ctx = Context::new();
//! ctx.insert("env".to_string(), serde_value::Value::String("prod".to_string()));
//!
//! // Generic error
//! if dice_roll == 7 {
//! return Err(UnExpectedError::new().with_message("Something went wrong".to_string()).with_details(ctx.dump()).into());
//! }
//!
//! Ok(())
//! }
//! ```
pub use ;
pub use ;