Skip to main content

RouterDef

Trait RouterDef 

Source
pub trait RouterDef<B, State = (), RetryPipeline = PublishIdentity>
where B: Broker,
{ }
Expand description

A mountable group of handler registrations.

Mounting applies the app’s global BlanketLayer to each handler and registers it, so the app-wide layer stack reaches router handlers. Implemented by Router and its internal registration list; you obtain one from a builder and pass it to include_router. You do not implement it.

State is the app’s shared-state type: a router whose handlers read typed state is RouterDef<B, State> only for that State, while a state-agnostic router is generic over it, so it mounts on any app.

RetryPipeline is the publish path a registration’s retry copies travel: a router hands its own down to its registrations, and the parameter defaults to PublishIdentity, which is the path of a router built without publish middleware - so RouterDef<B> names what a builder function returns.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<B, Head, Tail, State, RetryPipeline> RouterDef<B, State, RetryPipeline> for (Head, Tail)
where B: Broker + 'static, Head: MountRoute<B, State, RetryPipeline>, Tail: RouterDef<B, State, RetryPipeline>,

Source§

impl<B, State, RetryPipeline> RouterDef<B, State, RetryPipeline> for ()
where B: Broker + 'static,

Implementors§

Source§

impl<B, Routes, C, Layers, Pipe, State, RetryPipeline> RouterDef<B, State, RetryPipeline> for Router<B, Routes, C, Layers, Pipe>
where B: Broker + 'static, Routes: RouterDef<B, State, Pipe>, Layers: BlanketLayer + Clone + Send + Sync + 'static,