Skip to main content

PathRouter

Trait PathRouter 

Source
pub trait PathRouter<State = (), CurrentPathParameters = ()>: PathRouterIsSealed {
    // Required method
    async fn call_path_router<R: Read, W: ResponseWriter<Error = R::Error>>(
        &self,
        state: &State,
        current_path_parameters: CurrentPathParameters,
        path: Path<'_>,
        request: Request<'_, R>,
        response_writer: W,
    ) -> Result<ResponseSent, W::Error>;
}
Expand description

Routes a request based on its path.

Required Methods§

Source

async fn call_path_router<R: Read, W: ResponseWriter<Error = R::Error>>( &self, state: &State, current_path_parameters: CurrentPathParameters, path: Path<'_>, request: Request<'_, R>, response_writer: W, ) -> Result<ResponseSent, W::Error>

Handle the request and write the response to the provided ResponseWriter.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<State, CurrentPathParameters> PathRouter<State, CurrentPathParameters> for NotFound

Source§

impl<State, CurrentPathParameters, Left: PathRouter<State, CurrentPathParameters>, Right: PathRouter<State, CurrentPathParameters>> PathRouter<State, CurrentPathParameters> for EitherPathRoute<Left, Right>

Source§

impl<State, CurrentPathParameters, Service: PathRouterService<State, CurrentPathParameters>> PathRouter<State, CurrentPathParameters> for ServicePathRouter<Service>