Struct reep::resource_endpoint::ResourceEndpointBuilder
[−]
[src]
pub struct ResourceEndpointBuilder<I: Id + Any, OpP: ParserMiddleware, R: Resource, BoP: ParserMiddleware> { /* fields omitted */ }
The ResourceEndpointBuilder is the only provieded way to create a ResourceEndpoint it will automatikly inject the gicen body parser and options parser in the routs witch need them. Same is true for a IdParser internaly created using Id type provided by the resource
Methods
impl<OpP: OptionParser, R: Resource, BoP: BodyParser<R>> ResourceEndpointBuilder<R::RId, OpP, R, BoP> where
R::RId: Sync + Send + Any,
[src]
R::RId: Sync + Send + Any,
fn new(
route_id_base: String,
option_parser: OpP,
body_parser: BoP
) -> ResourceEndpointBuilder<R::RId, OpP, R, BoP>
route_id_base: String,
option_parser: OpP,
body_parser: BoP
) -> ResourceEndpointBuilder<R::RId, OpP, R, BoP>
create a new ResourceEndpointBuilder The restrictions on the generic types and their Associatvie Types will assure that Resource, Resource Id, IdParser and BodyParser fit together IdIndo is soly used to provide the IdType and a Key Type for accessing it over the reqest.extension typemap.
fn is_method_set(&self, method: ResourceMethod) -> bool
Check if a handler/Method for givven ResourceMethod is set
fn finalize(self) -> ResourceEndpoint
Consumes the Builder to Create the final produkt simple implementation for CustomHttpOptions/CustomHttpOptionsList will be added if not provided when building
fn route<H: Handler>(self, resource_method: ResourceMethod, handler: H) -> Self
attach a handler for a given ResourceMethod Depending on the handler the Body, Id and Option Parsers might be injected as BeforeMiddleware
Panic
Panics if a handler was already provided for the Methodd. Use is_method_set to check if you cann't be sure
fn create<H: Handler>(self, handler: H) -> Self
shorthand for route(ResourceMethod::Create, handler)
fn list<H: Handler>(self, handler: H) -> Self
shorthand for route(ResourceMethod::List, handler)
fn delete<H: Handler>(self, handler: H) -> Self
shorthand for route(ResourceMethod::Delete, handler)
fn replace<H: Handler>(self, handler: H) -> Self
shorthand for route(ResourceMethod::Replace, handler)
fn get<H: Handler>(self, handler: H) -> Self
shorthand for route(ResourceMethod::Get, handler)