pub struct Router { /* private fields */ }Expand description
A simple method-name → handler router that implements RpcHandler.
Implementations§
Source§impl Router
impl Router
Sourcepub fn lifecycle(
self,
drain: DrainController,
probe: Option<Arc<dyn ProbeSink>>,
) -> Self
pub fn lifecycle( self, drain: DrainController, probe: Option<Arc<dyn ProbeSink>>, ) -> Self
Register the standard lifecycle RPC methods (Lifecycle.Drain,
Lifecycle.Reload, Lifecycle.Status, Lifecycle.Health) wired to a
shared DrainController and an optional ProbeSink.
Lifecycle.Drain begins a graceful drain; Lifecycle.Status /
Lifecycle.Health reflect the probe (or a minimal default when probe
is None). Chain further .route(...) calls after this.
Trait Implementations§
Source§impl RpcHandler for Router
impl RpcHandler for Router
Source§fn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
req: &'life1 Request,
) -> Pin<Box<dyn Future<Output = Result<Value, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle<'life0, 'life1, 'async_trait>(
&'life0 self,
req: &'life1 Request,
) -> Pin<Box<dyn Future<Output = Result<Value, RpcError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Invoke the method named in
req, returning either a result value or an
RpcError. Notifications (no id) are still dispatched; the server
simply discards the returned value for them.Auto Trait Implementations§
impl !RefUnwindSafe for Router
impl !UnwindSafe for Router
impl Freeze for Router
impl Send for Router
impl Sync for Router
impl Unpin for Router
impl UnsafeUnpin for Router
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more