Struct Form
struct Form<T>(202)
URL encoded extractor and response.
As extractor
If used as an extractor, Form will deserialize form data from the request,
specifically:
- If the request has a method of
GETorHEAD, the form data will be read from the query string (same as withQuery) - If the request has a different method, the form will be read from the body
of the request. It must have a
content-typeofapplication/x-www-form-urlencodedfor this to work. If you want to parsemultipart/form-datarequest bodies, useMultipartinstead.
This matches how HTML forms are sent by browsers by default.
In both cases, the inner type T must implement serde::Deserialize.
⚠️ Since parsing form data might require consuming the request body, the Form extractor must be
last if there are multiple extractors in a handler. See "the order of
extractors"
use Form;
use Deserialize;
async
As response
Form can also be used to encode any type that implements
serde::Serialize as application/x-www-form-urlencoded
use Form;
use Serialize;
async
Implementations
impl<H, T> HandlerWithoutStateExt for Form<T>
fn into_service(self: Self) -> HandlerService<H, T, ()>fn into_make_service(self: Self) -> IntoMakeService<HandlerService<H, T, ()>>fn into_make_service_with_connect_info<C>(self: Self) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>
impl<P, T> Receiver for Form<T>
impl<R> Rng for Form<T>
impl<R> TryCryptoRng for Form<T>
impl<R> TryRngCore for Form<T>
fn try_next_u32(self: &mut Self) -> Result<u32, <R as TryRngCore>::Error>fn try_next_u64(self: &mut Self) -> Result<u64, <R as TryRngCore>::Error>fn try_fill_bytes(self: &mut Self, dst: &mut [u8]) -> Result<(), <R as TryRngCore>::Error>
impl<T> Any for Form<T>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Form<T>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Form<T>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Form<T>
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> CryptoRng for Form<T>
impl<T> Deref for Form<T>
fn deref(self: &Self) -> &<Self as >::Target
impl<T> DerefMut for Form<T>
fn deref_mut(self: &mut Self) -> &mut <Self as >::Target
impl<T> Freeze for Form<T>
impl<T> From for Form<T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> FromRef for Form<T>
fn from_ref(input: &T) -> T
impl<T> Instrument for Form<T>
impl<T> IntoResponse for Form<T>
fn into_response(self: Self) -> Response
impl<T> RefUnwindSafe for Form<T>
impl<T> RngCore for Form<T>
fn next_u32(self: &mut Self) -> u32fn next_u64(self: &mut Self) -> u64fn fill_bytes(self: &mut Self, dst: &mut [u8])
impl<T> Same for Form<T>
impl<T> Send for Form<T>
impl<T> Sync for Form<T>
impl<T> ToOwned for Form<T>
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T> Unpin for Form<T>
impl<T> UnsafeUnpin for Form<T>
impl<T> UnwindSafe for Form<T>
impl<T> WithSubscriber for Form<T>
impl<T, S> FromRequest for Form<T>
async fn from_request(req: Request, _state: &S) -> Result<Self, <Self as >::Rejection>
impl<T, U> Into for Form<T>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Form<T>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Form<T>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>
impl<T: $crate::clone::Clone> Clone for Form<T>
fn clone(self: &Self) -> Form<T>
impl<T: $crate::default::Default> Default for Form<T>
fn default() -> Form<T>
impl<T: $crate::fmt::Debug> Debug for Form<T>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<T: $crate::marker::Copy> Copy for Form<T>
impl<V, T> VZip for Form<T>
fn vzip(self: Self) -> V