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§
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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,
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.