Routable

Trait Routable 

Source
pub trait Routable<T>: Send + Sync
where T: CapabilityBound,
{ // Required method fn route<'life0, 'async_trait>( &'life0 self, request: Option<Request>, debug: bool, ) -> Pin<Box<dyn Future<Output = Result<RouterResponse<T>, RouterError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; }
Expand description

Types that implement Routable let the holder asynchronously request capabilities from them.

Required Methods§

Source

fn route<'life0, 'async_trait>( &'life0 self, request: Option<Request>, debug: bool, ) -> Pin<Box<dyn Future<Output = Result<RouterResponse<T>, RouterError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§

Source§

impl<T: CapabilityBound> Routable<T> for Router<T>

Source§

impl<T: CapabilityBound, F> Routable<T> for F
where F: Fn(Option<Request>, bool) -> BoxFuture<'static, Result<RouterResponse<T>, RouterError>> + Send + Sync + 'static,

Syntax sugar within the framework to express custom routing logic using a function that takes a request and returns such future.