Skip to main content

RumaHandler

Trait RumaHandler 

Source
pub trait RumaHandler<T> {
    // Required methods
    fn add_routes(&'static self, router: Router<State>) -> Router<State>;
    fn add_route(
        &'static self,
        router: Router<State>,
        path: &str,
    ) -> Router<State>;
    fn call_route(
        handler: &'static (dyn Any + Send + Sync),
        state: State,
        request: Request<Body>,
    ) -> impl Future<Output = Response> + Send + 'static;
}
Expand description

Registers Matrix request handlers with a router.

Implementations convert incoming requests and dispatch them to endpoint handlers.

Required Methods§

Source

fn add_routes(&'static self, router: Router<State>) -> Router<State>

Registers every path declared by the request type.

Each path dispatches requests to this handler.

Source

fn add_route(&'static self, router: Router<State>, path: &str) -> Router<State>

Registers the handler at one endpoint path.

The returned router dispatches matching requests to this handler.

Source

fn call_route( handler: &'static (dyn Any + Send + Sync), state: State, request: Request<Body>, ) -> impl Future<Output = Response> + Send + 'static

Dispatches an incoming request to the endpoint handler.

The returned future resolves to the HTTP response.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<Err, Req, Fut, Fun, const ADMIN: bool, T1, T2, T3, T4> RumaHandler<(T1, T2, T3, T4, Args<Req, ADMIN>)> for Fun
where Fun: Fn(T1, T2, T3, T4, Ruma<Req, ADMIN>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<Req::OutgoingResponse, Err>> + Send + 'static, Req: IncomingRequest + Debug + Send + Sync + 'static, Req::Authentication: AuthDispatch, Err: IntoResponse + Send, <Req as IncomingRequest>::OutgoingResponse: Send, T1: FromRequestParts<State> + Send + Sync + 'static, T2: FromRequestParts<State> + Send + Sync + 'static, T3: FromRequestParts<State> + Send + Sync + 'static, T4: FromRequestParts<State> + Send + Sync + 'static,

Source§

impl<Err, Req, Fut, Fun, const ADMIN: bool, T1, T2, T3> RumaHandler<(T1, T2, T3, Args<Req, ADMIN>)> for Fun
where Fun: Fn(T1, T2, T3, Ruma<Req, ADMIN>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<Req::OutgoingResponse, Err>> + Send + 'static, Req: IncomingRequest + Debug + Send + Sync + 'static, Req::Authentication: AuthDispatch, Err: IntoResponse + Send, <Req as IncomingRequest>::OutgoingResponse: Send, T1: FromRequestParts<State> + Send + Sync + 'static, T2: FromRequestParts<State> + Send + Sync + 'static, T3: FromRequestParts<State> + Send + Sync + 'static,

Source§

impl<Err, Req, Fut, Fun, const ADMIN: bool, T1, T2> RumaHandler<(T1, T2, Args<Req, ADMIN>)> for Fun
where Fun: Fn(T1, T2, Ruma<Req, ADMIN>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<Req::OutgoingResponse, Err>> + Send + 'static, Req: IncomingRequest + Debug + Send + Sync + 'static, Req::Authentication: AuthDispatch, Err: IntoResponse + Send, <Req as IncomingRequest>::OutgoingResponse: Send, T1: FromRequestParts<State> + Send + Sync + 'static, T2: FromRequestParts<State> + Send + Sync + 'static,

Source§

impl<Err, Req, Fut, Fun, const ADMIN: bool, T1> RumaHandler<(T1, Args<Req, ADMIN>)> for Fun
where Fun: Fn(T1, Ruma<Req, ADMIN>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<Req::OutgoingResponse, Err>> + Send + 'static, Req: IncomingRequest + Debug + Send + Sync + 'static, Req::Authentication: AuthDispatch, Err: IntoResponse + Send, <Req as IncomingRequest>::OutgoingResponse: Send, T1: FromRequestParts<State> + Send + Sync + 'static,

Source§

impl<Err, Req, Fut, Fun, const ADMIN: bool> RumaHandler<(Args<Req, ADMIN>,)> for Fun
where Fun: Fn(Ruma<Req, ADMIN>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<Req::OutgoingResponse, Err>> + Send + 'static, Req: IncomingRequest + Debug + Send + Sync + 'static, Req::Authentication: AuthDispatch, Err: IntoResponse + Send, <Req as IncomingRequest>::OutgoingResponse: Send,