pub struct Router {
registry: Arc<ProviderRegistry>,
resolver: RouteResolver,
}
Expand description
Router handles all incoming requests and routes them to providers
Fields§
§registry: Arc<ProviderRegistry>
Provider registry
resolver: RouteResolver
Route resolver for finding providers
Implementations§
Source§impl Router
impl Router
Sourcepub fn new(registry: Arc<ProviderRegistry>) -> Self
pub fn new(registry: Arc<ProviderRegistry>) -> Self
Create a new router
Sourcepub async fn route_request(
&self,
route: Route,
args: HashMap<String, Value>,
) -> ProviderResult<Value>
pub async fn route_request( &self, route: Route, args: HashMap<String, Value>, ) -> ProviderResult<Value>
Route a request to the appropriate provider
Sourcepub async fn route_path(
&self,
path: &str,
args: HashMap<String, Value>,
) -> ProviderResult<Value>
pub async fn route_path( &self, path: &str, args: HashMap<String, Value>, ) -> ProviderResult<Value>
Route a request from a path string
Sourcepub async fn route_url_path(
&self,
url_path: &str,
args: HashMap<String, Value>,
) -> ProviderResult<Value>
pub async fn route_url_path( &self, url_path: &str, args: HashMap<String, Value>, ) -> ProviderResult<Value>
Route a request from URL path (removes /providers/ prefix)
Sourcepub async fn get_available_routes(&self) -> ProviderResult<Vec<Route>>
pub async fn get_available_routes(&self) -> ProviderResult<Vec<Route>>
Get all available routes
Sourcepub async fn get_provider_routes(
&self,
provider: &str,
) -> ProviderResult<Vec<Route>>
pub async fn get_provider_routes( &self, provider: &str, ) -> ProviderResult<Vec<Route>>
Get routes for a specific provider
Sourcepub async fn get_feature_routes(
&self,
provider: &str,
feature: &str,
) -> ProviderResult<Vec<Route>>
pub async fn get_feature_routes( &self, provider: &str, feature: &str, ) -> ProviderResult<Vec<Route>>
Get routes for a specific feature
Sourcepub async fn is_route_valid(&self, route: &Route) -> bool
pub async fn is_route_valid(&self, route: &Route) -> bool
Check if a route is valid
Sourcepub async fn get_route_metadata(
&self,
route: &Route,
) -> ProviderResult<RouteMetadata>
pub async fn get_route_metadata( &self, route: &Route, ) -> ProviderResult<RouteMetadata>
Get route metadata
Auto Trait Implementations§
impl Freeze for Router
impl !RefUnwindSafe for Router
impl Send for Router
impl Sync for Router
impl Unpin for Router
impl !UnwindSafe 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