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
68
69
//! Middleware: the core [`Middleware`] trait + [`ClientWithMiddleware`]
//! chain runner, plus the bundled feature-gated implementations.
//!
//! # Ordering semantics
//!
//! Middleware wrap the transport in an onion; the middleware registered
//! **first** is the **outermost** layer — it observes the request first
//! and the response last:
//!
//! ```text
//! ClientBuilder::new(client)
//! .with(AuthMiddleware) // 1st registered → outermost
//! .with(RetryMiddleware::new(config))
//! .build();
//!
//! request → Auth → Retry → transport
//! response ← Auth ← Retry ← ╹
//! ```
//!
//! Inner middleware therefore see *every attempt* a retry-style outer
//! middleware issues, and outer middleware see only the final outcome.
//! The built-in default client composes `[retry, breaker]`: the breaker
//! sits inside the retry loop and records each HTTP attempt
//! individually.
//!
//! # Built-ins vs middleware (the composition story)
//!
//! The bundled middleware are the *composition points*; the
//! [`crate::ClientBuilder`] knobs are the *defaults*:
//!
//! | Knob (default) | Middleware equivalent (composable) |
//! |---|---|
//! | `retries` / `retry_bounds` | `RetryMiddleware` (feature `retry`, default-on) |
//! | `with_breaker` | `CircuitBreakerMiddleware` (feature `circuit-breaker`) |
//! | — | `ThrottleMiddleware` (feature `throttle`) |
//! | — | `TimeoutMiddleware` (feature `timeout`) |
//! | `base_url` (eager) | `BaseUrlMiddleware` (feature `base-url`) |
//!
//! [`crate::ClientBuilder::with_middleware`] registers custom middleware
//! **outermost** — wrapping the built-ins — so user middleware observe the
//! final outcome of the whole default stack.
pub use ;
pub use ;
pub use CircuitBreakerMiddleware;
pub use RetryConfig;
pub use ;
pub use ThrottleMiddleware;
pub use TimeoutMiddleware;