pub struct AsyncAppWithState<S> { /* private fields */ }Expand description
An Application whose route handlers are async functions.
State is stored as Arc<S> and passed by value (cheap clone) to each
handler invocation. Handlers receive owned Request, PathParams, and
ConnectionInfo values so the returned future is 'static.
Implementations§
Source§impl<S: Send + Sync + 'static> AsyncAppWithState<S>
impl<S: Send + Sync + 'static> AsyncAppWithState<S>
Sourcepub fn get<F, Fut>(self, pattern: &str, handler: F) -> Selfwhere
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
pub fn get<F, Fut>(self, pattern: &str, handler: F) -> Selfwhere
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
Register an async GET handler for pattern.
Sourcepub fn post<F, Fut>(self, pattern: &str, handler: F) -> Selfwhere
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
pub fn post<F, Fut>(self, pattern: &str, handler: F) -> Selfwhere
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
Register an async POST handler for pattern.
Sourcepub fn put<F, Fut>(self, pattern: &str, handler: F) -> Selfwhere
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
pub fn put<F, Fut>(self, pattern: &str, handler: F) -> Selfwhere
F: Fn(Request, PathParams, ConnectionInfo, Arc<S>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Response> + Send + 'static,
Register an async PUT handler for pattern.
Trait Implementations§
Source§impl<S: Send + Sync + 'static> Application for AsyncAppWithState<S>
impl<S: Send + Sync + 'static> Application for AsyncAppWithState<S>
Auto Trait Implementations§
impl<S> !RefUnwindSafe for AsyncAppWithState<S>
impl<S> !UnwindSafe for AsyncAppWithState<S>
impl<S> Freeze for AsyncAppWithState<S>
impl<S> Send for AsyncAppWithState<S>
impl<S> Sync for AsyncAppWithState<S>
impl<S> Unpin for AsyncAppWithState<S>
impl<S> UnsafeUnpin for AsyncAppWithState<S>
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