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
//! Tiny peer-service client primitives. No server-framework deps.
//!
//! # When to use
//!
//! Service B calls Service A — pull this in, **not** [`tonin-core`],
//! which drags the tonic server stack, OTLP telemetry SDK, MCP sidecar
//! runtime, JWT validation and JWKS fetching along with it. This crate
//! holds only the contract pieces a caller actually needs: auth context,
//! retry/breaker config, and W3C trace propagation.
//!
//! # Example
//!
//! Propagate an inbound `AuthCtx` + `traceparent` onto an outbound tonic
//! request:
//!
//! ```rust,no_run
//! use tonin_client::{AuthCtx, propagate};
//! use tonic::Request;
//!
//! fn forward(inbound: &Request<()>) -> Request<()> {
//! let caller = AuthCtx::from(inbound);
//! let mut outbound = Request::new(());
//! caller.propagate(&mut outbound);
//! propagate::inject_traceparent(
//! &mut outbound,
//! "00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01",
//! );
//! outbound
//! }
//! ```
//!
//! # Modules
//!
//! - [`auth`] — `AuthCtx`, `RawToken`, `PrincipalKind`, `AuthError`.
//! - [`retry`] — `RetryPolicy`, `Backoff`, `RetryableCodes`.
//! - [`breaker`] — `CircuitBreaker` config with three-state presets.
//! - [`propagate`] — W3C `traceparent` / `tracestate` injection.
//!
//! # Sample app
//!
//! <https://github.com/Rushit/tonin/tree/main/examples/greeter> —
//! Service B in the demo depends on this crate to call Service A.
//!
//! # Sibling crates
//!
//! - <https://docs.rs/tonin> — umbrella crate for service authors.
//! - <https://docs.rs/tonin-core> — server runtime (use on the
//! service being called, not on the caller).
//!
//! [`tonin-core`]: https://docs.rs/tonin-core
pub use ;