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
61
62
63
64
65
66
67
//! Core abstractions for the TurboClaude ecosystem.
//!
//! This crate provides foundational traits and utilities that are shared
//! across all TurboClaude crates, enabling:
//!
//! - **Universal retry strategies** via `BackoffStrategy` trait
//! - Exponential backoff with jitter
//! - Custom retry predicates
//! - Circuit breaker support (future)
//! - **Consistent resource lifecycle management** via `Resource<T>` and `LazyResource<T>`
//! - **Declarative error boundaries** via `error_boundary!` macro
//! - **Standardized serialization** via `SerializePipeline` trait
//!
//! # Design Philosophy
//!
//! This crate consolidates duplicated patterns across the TurboClaude ecosystem:
//!
//! - **Before**: Retry logic duplicated in 2 places with different APIs
//! - **After**: One universal abstraction, multiple implementations
//! - **Before**: Error conversion via repetitive `map_err()` chains
//! - **After**: Declarative `error_boundary!` definitions at module boundaries
//! - **Before**: Manual serde method calls scattered throughout codebase
//! - **After**: Unified `SerializePipeline` interface for all protocol types
//!
//! # Examples
//!
//! Using the prelude for convenient imports:
//!
//! ```rust
//! use turboclaude_core::prelude::*;
//! use std::time::Duration;
//!
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! let backoff = ExponentialBackoff::builder()
//! .max_retries(3)
//! .initial_delay(Duration::from_millis(100))
//! .build();
//!
//! let result = backoff.execute(|| async {
//! Ok::<_, std::io::Error>(42)
//! }).await?;
//! # Ok(())
//! # }
//! ```
/// Convenient re-exports of commonly used items.
///
/// Import all core abstractions with:
///
/// ```rust
/// use turboclaude_core::prelude::*;
/// ```