procwire_client/handler/mod.rs
1//! Handler module - request handling and dispatch.
2//!
3//! Provides:
4//! - [`HandlerRegistry`] - maps method IDs to handlers
5//! - [`RequestContext`] - allows handlers to respond, stream, etc.
6//!
7//! # Example
8//!
9//! ```ignore
10//! use procwire_client::handler::{HandlerRegistry, RequestContext};
11//! use procwire_client::control::ResponseType;
12//!
13//! let mut registry = HandlerRegistry::new();
14//!
15//! // Register a method handler
16//! registry.register("echo", ResponseType::Result, |data: String, ctx| async move {
17//! ctx.respond(&data).await
18//! });
19//!
20//! // Register a streaming handler
21//! registry.register("count", ResponseType::Stream, |n: i32, ctx| async move {
22//! for i in 0..n {
23//! ctx.chunk(&i).await?;
24//! }
25//! ctx.end().await
26//! });
27//! ```
28
29mod context;
30mod registry;
31
32pub use context::{RawPayload, RequestContext};
33pub use registry::{BoxFuture, Handler, HandlerRegistry, HandlerResult, TypedHandler};