pub struct Build<M, H> { /* private fields */ }
Expand description
The builder for the router. This collects all of the routes that the router will have, and then builds the cache to quickly perform lookups for that router.
Implementations§
Source§impl Build<Method, Box<dyn Fn(Request<Body>, Vec<String>) -> Box<dyn Future<Item = Response<Body>, Error = Error> + Send> + Send>>
impl Build<Method, Box<dyn Fn(Request<Body>, Vec<String>) -> Box<dyn Future<Item = Response<Body>, Error = Error> + Send> + Send>>
pub fn options<P, F>(&mut self, path: P, handler: F) -> &mut Self
pub fn get<P, F>(&mut self, path: P, handler: F) -> &mut Self
pub fn post<P, F>(&mut self, path: P, handler: F) -> &mut Self
pub fn put<P, F>(&mut self, path: P, handler: F) -> &mut Self
pub fn delete<P, F>(&mut self, path: P, handler: F) -> &mut Self
pub fn head<P, F>(&mut self, path: P, handler: F) -> &mut Self
pub fn trace<P, F>(&mut self, path: P, handler: F) -> &mut Self
pub fn connect<P, F>(&mut self, path: P, handler: F) -> &mut Self
pub fn patch<P, F>(&mut self, path: P, handler: F) -> &mut Self
pub fn default_fn<F>(&mut self, default: F) -> &mut Self
Source§impl<M, H> Build<M, H>
impl<M, H> Build<M, H>
Sourcepub fn with_default(&mut self, default: H) -> &mut Self
pub fn with_default(&mut self, default: H) -> &mut Self
Sets the default of the builder. If no other route matches the given path, the default is instead returned. Because there was no route to match, there will obviously be no url parameters in that match, either.
Trait Implementations§
Auto Trait Implementations§
impl<M, H> Freeze for Build<M, H>where
H: Freeze,
impl<M, H> RefUnwindSafe for Build<M, H>where
H: RefUnwindSafe,
M: RefUnwindSafe,
impl<M, H> Send for Build<M, H>
impl<M, H> Sync for Build<M, H>
impl<M, H> Unpin for Build<M, H>
impl<M, H> UnwindSafe for Build<M, H>where
H: UnwindSafe,
M: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more