Trait Router

Source
pub trait Router:
    Debug
    + Send
    + Sync {
    // Required methods
    fn route<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: &'life1 ProxyRequest,
    ) -> Pin<Box<dyn Future<Output = Result<Route, ProxyError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_routes<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Vec<Route>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn add_route<'life0, 'async_trait>(
        &'life0 self,
        route: Route,
    ) -> Pin<Box<dyn Future<Output = Result<(), ProxyError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn remove_route<'life0, 'life1, 'async_trait>(
        &'life0 self,
        route_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), ProxyError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

A router that matches requests to routes.

Required Methods§

Source

fn route<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 ProxyRequest, ) -> Pin<Box<dyn Future<Output = Result<Route, ProxyError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Find a route for the given request.

Source

fn get_routes<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Vec<Route>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get all routes managed by this router.

Source

fn add_route<'life0, 'async_trait>( &'life0 self, route: Route, ) -> Pin<Box<dyn Future<Output = Result<(), ProxyError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Add a new route to the router.

Source

fn remove_route<'life0, 'life1, 'async_trait>( &'life0 self, route_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), ProxyError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Remove a route from the router.

Implementors§