pub struct FormHandler<H, R> { /* private fields */ }Expand description
Handles a POST request with the axum::extract::Form extractor and passes it to the provided DataHandler (in H).
The Self::response_renderer will be used for rendering a response, it will be provided with a HandlerError<DataHandler::Error> as an axum::extract::Extension so it can react to errors during handling. Additionally it will be provided with the DataHandler::Extension so that additional data can be used for communicating to the user.
Note: When using the Into::into call to convert this handler into a MethodRouter for axum, the Self::response_renderer will also
be used for the MethodRouter::get call
Implementations§
Source§impl<P, R> FormHandler<P, R>
impl<P, R> FormHandler<P, R>
Trait Implementations§
Source§impl<H: Clone, R: Clone> Clone for FormHandler<H, R>
impl<H: Clone, R: Clone> Clone for FormHandler<H, R>
Source§fn clone(&self) -> FormHandler<H, R>
fn clone(&self) -> FormHandler<H, R>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<S, H, R> From<FormHandler<H, R>> for MethodRouter<S>where
Self: Send,
S: Clone + Send + Sync + 'static + ProvideState<Templating> + ProvideState<H>,
H: DataHandler<S> + Clone + Send + Sync + 'static,
<<H as DataHandler<S>>::Args as FromRequestParts<S>>::Rejection: Send + Sync,
<H as DataHandler<S>>::Body: Send,
<H as DataHandler<S>>::Error: Clone + Send + Sync + 'static,
R: Clone + Send + Sync + 'static + Handler<Response, S>,
impl<S, H, R> From<FormHandler<H, R>> for MethodRouter<S>where
Self: Send,
S: Clone + Send + Sync + 'static + ProvideState<Templating> + ProvideState<H>,
H: DataHandler<S> + Clone + Send + Sync + 'static,
<<H as DataHandler<S>>::Args as FromRequestParts<S>>::Rejection: Send + Sync,
<H as DataHandler<S>>::Body: Send,
<H as DataHandler<S>>::Error: Clone + Send + Sync + 'static,
R: Clone + Send + Sync + 'static + Handler<Response, S>,
Source§fn from(val: FormHandler<H, R>) -> Self
fn from(val: FormHandler<H, R>) -> Self
Converts to this type from the input type.
Source§impl<S, H, R, T> Handler<T, S> for FormHandler<H, R>where
Self: Send,
T: 'static,
S: Clone + Send + Sync + 'static + ProvideState<Templating> + ProvideState<H>,
H: DataHandler<S> + Clone + Send + Sync + 'static,
<<H as DataHandler<S>>::Args as FromRequestParts<S>>::Rejection: Send + Sync,
<H as DataHandler<S>>::Body: Send,
<H as DataHandler<S>>::Error: Clone + Send + Sync + 'static,
R: Clone + Send + Sync + 'static + Handler<T, S>,
impl<S, H, R, T> Handler<T, S> for FormHandler<H, R>where
Self: Send,
T: 'static,
S: Clone + Send + Sync + 'static + ProvideState<Templating> + ProvideState<H>,
H: DataHandler<S> + Clone + Send + Sync + 'static,
<<H as DataHandler<S>>::Args as FromRequestParts<S>>::Rejection: Send + Sync,
<H as DataHandler<S>>::Body: Send,
<H as DataHandler<S>>::Error: Clone + Send + Sync + 'static,
R: Clone + Send + Sync + 'static + Handler<T, S>,
Source§type Future = Pin<Box<dyn Future<Output = Response<Body>> + Send>>
type Future = Pin<Box<dyn Future<Output = Response<Body>> + Send>>
The type of future calling this handler returns.
Source§fn call(self, request: Request, state: S) -> Self::Future
fn call(self, request: Request, state: S) -> Self::Future
Call the handler with the given request.
Source§fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
Apply a
tower::Layer to the handler. Read moreSource§fn with_state(self, state: S) -> HandlerService<Self, T, S>
fn with_state(self, state: S) -> HandlerService<Self, T, S>
Convert the handler into a
Service by providing the stateAuto Trait Implementations§
impl<H, R> Freeze for FormHandler<H, R>where
R: Freeze,
impl<H, R> RefUnwindSafe for FormHandler<H, R>where
R: RefUnwindSafe,
H: RefUnwindSafe,
impl<H, R> Send for FormHandler<H, R>
impl<H, R> Sync for FormHandler<H, R>
impl<H, R> Unpin for FormHandler<H, R>
impl<H, R> UnsafeUnpin for FormHandler<H, R>where
R: UnsafeUnpin,
impl<H, R> UnwindSafe for FormHandler<H, R>where
R: UnwindSafe,
H: 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