[][src]Struct saphir::controller::EndpointsBuilder

pub struct EndpointsBuilder<C: Controller> { /* fields omitted */ }

Builder to simplify returning a list of endpoint in the handlers method of the controller trait

Implementations

impl<C: Controller> EndpointsBuilder<C>[src]

pub fn new() -> Self[src]

Create a new endpoint builder

pub fn add<H>(self, method: Method, route: &'static str, handler: H) -> Self where
    H: 'static + DynControllerHandler<C, Body> + Send + Sync
[src]

Add a endpoint the the builder



impl BasicController {
    async fn healthz(&self, req: Request<Body>) -> impl Responder {200}
}

let b: EndpointsBuilder<BasicController> = EndpointsBuilder::new().add(Method::GET, "/healthz", BasicController::healthz);

pub fn add_with_guards<H, F, Chain>(
    self,
    method: Method,
    route: &'static str,
    handler: H,
    guards: F
) -> Self where
    H: 'static + DynControllerHandler<C, Body> + Send + Sync,
    F: FnOnce(GuardBuilder<GuardChainEnd>) -> GuardBuilder<Chain>,
    Chain: GuardChain + 'static, 
[src]

Add a guarded endpoint the the builder

pub fn build(self) -> Vec<ControllerEndpoint<C>>[src]

Finish the builder into a Vec<ControllerEndpoint<C>>

Trait Implementations

impl<C: Default + Controller> Default for EndpointsBuilder<C>[src]

Auto Trait Implementations

impl<C> !RefUnwindSafe for EndpointsBuilder<C>

impl<C> Send for EndpointsBuilder<C>

impl<C> Sync for EndpointsBuilder<C>

impl<C> Unpin for EndpointsBuilder<C>

impl<C> !UnwindSafe for EndpointsBuilder<C>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.