Expand description
Handler module - request handling and dispatch.
Provides:
HandlerRegistry- maps method IDs to handlersRequestContext- allows handlers to respond, stream, etc.
§Example
ⓘ
use procwire_client::handler::{HandlerRegistry, RequestContext};
use procwire_client::control::ResponseType;
let mut registry = HandlerRegistry::new();
// Register a method handler
registry.register("echo", ResponseType::Result, |data: String, ctx| async move {
ctx.respond(&data).await
});
// Register a streaming handler
registry.register("count", ResponseType::Stream, |n: i32, ctx| async move {
for i in 0..n {
ctx.chunk(&i).await?;
}
ctx.end().await
});Structs§
- Handler
Registry - Registry mapping method names to handlers.
- RawPayload
- Wrapper for Bytes payload (zero-copy).
- Request
Context - Context passed to request handlers.
- Typed
Handler - Wrapper that deserializes payload before calling the handler.
Traits§
- Handler
- Trait for handler functions.
Type Aliases§
- BoxFuture
- Boxed future for handler results.
- Handler
Result - Result type for handler functions.