Skip to main content

Route

Trait Route 

Source
pub trait Route: Send + Sync {
    // Required methods
    fn validate_requirements(
        &self,
        params: &ParamsNames<'_>,
        resources: &Resources,
    );
    fn path(&self) -> RoutePath;
    fn call<'a>(
        &'a self,
        req: &'a mut Request,
        params: &'a PathParams,
        resources: &'a Resources,
    ) -> PinnedFuture<'a, Result<Response>> ;
}
Expand description

A Route is sort of a request handler

If possible you should use the provided macros which implement Route for you.

Required Methods§

Source

fn validate_requirements(&self, params: &ParamsNames<'_>, resources: &Resources)

Source

fn path(&self) -> RoutePath

Source

fn call<'a>( &'a self, req: &'a mut Request, params: &'a PathParams, resources: &'a Resources, ) -> PinnedFuture<'a, Result<Response>>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl Route for GraphiQl

Available on crate feature graphql only.
Source§

impl<Q, M, Sub, S> Route for GraphQl<Q, M, Sub, S>
where Q: GraphQLTypeAsync<S, Context = GraphQlContext> + Send, Q::TypeInfo: Send + Sync, M: GraphQLTypeAsync<S, Context = GraphQlContext> + Send, M::TypeInfo: Send + Sync, Sub: GraphQLSubscriptionType<S, Context = GraphQlContext> + Send, Sub::TypeInfo: Send + Sync, S: ScalarValue + Send + Sync,

Available on crate feature graphql only.