Trait viz_core::RequestExt
source · [−]pub trait RequestExt {
Show 21 methods
fn path(&self) -> &str;
fn query_string(&self) -> Option<&str>;
fn query<T>(&self) -> Result<T, PayloadError>
where
T: DeserializeOwned;
fn header<K, T>(&self, key: K) -> Option<T>
where
K: AsHeaderName,
T: FromStr;
fn content_length(&self) -> Option<u64>;
fn content_type(&self) -> Option<Mime>;
fn extract<'life0, 'async_trait, T>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<T, T::Error>> + Send + 'async_trait>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
T: FromRequest,
T: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait;
fn bytes<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<Bytes, PayloadError>> + Send + 'async_trait>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
'life0: 'async_trait,
Self: 'async_trait;
fn bytes_with<'life0, 'life1, 'async_trait>(
&'life0 mut self,
name: &'life1 str,
max: u64
) -> Pin<Box<dyn Future<Output = Result<Bytes, PayloadError>> + Send + 'async_trait>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn text<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<String, PayloadError>> + Send + 'async_trait>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
'life0: 'async_trait,
Self: 'async_trait;
fn form<'life0, 'async_trait, T>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<T, PayloadError>> + Send + 'async_trait>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
T: DeserializeOwned,
T: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait;
fn json<'life0, 'async_trait, T>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<T, PayloadError>> + Send + 'async_trait>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
T: DeserializeOwned,
T: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait;
fn multipart<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<Multipart, PayloadError>> + Send + 'async_trait>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
'life0: 'async_trait,
Self: 'async_trait;
fn data<T>(&self) -> Option<T>
where
T: Clone + Send + Sync + 'static;
fn set_data<T>(&mut self, t: T) -> Option<T>
where
T: Clone + Send + Sync + 'static;
fn cookies(&self) -> Result<Cookies, CookiesError>;
fn cookie<S>(&self, name: S) -> Option<Cookie<'_>>
where
S: AsRef<str>;
fn limits(&self) -> Limits;
fn session(&self) -> &Session;
fn params<T>(&self) -> Result<T, ParamsError>
where
T: DeserializeOwned;
fn param<T>(&self, name: &str) -> Result<T, ParamsError>
where
T: FromStr,
T::Err: Display;
}
Expand description
The Request Extension.
Required Methods
fn query_string(&self) -> Option<&str>
fn query_string(&self) -> Option<&str>
Get URL’s query string of this request.
fn query<T>(&self) -> Result<T, PayloadError> where
T: DeserializeOwned,
fn query<T>(&self) -> Result<T, PayloadError> where
T: DeserializeOwned,
query
only.Get query data by type.
fn header<K, T>(&self, key: K) -> Option<T> where
K: AsHeaderName,
T: FromStr,
fn header<K, T>(&self, key: K) -> Option<T> where
K: AsHeaderName,
T: FromStr,
Get a header with the specified type by the key.
fn content_length(&self) -> Option<u64>
fn content_length(&self) -> Option<u64>
Get the size of this request’s body.
fn content_type(&self) -> Option<Mime>
fn content_type(&self) -> Option<Mime>
Get the media type of this request.
fn extract<'life0, 'async_trait, T>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<T, T::Error>> + Send + 'async_trait>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
T: FromRequest,
T: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn extract<'life0, 'async_trait, T>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<T, T::Error>> + Send + 'async_trait>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
T: FromRequest,
T: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
Extract the data from this request by the specified type.
fn bytes<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<Bytes, PayloadError>> + Send + 'async_trait>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
'life0: 'async_trait,
Self: 'async_trait,
fn bytes<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<Bytes, PayloadError>> + Send + 'async_trait>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
'life0: 'async_trait,
Self: 'async_trait,
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
Return with a Bytes representation of the request body.
fn bytes_with<'life0, 'life1, 'async_trait>(
&'life0 mut self,
name: &'life1 str,
max: u64
) -> Pin<Box<dyn Future<Output = Result<Bytes, PayloadError>> + Send + 'async_trait>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn bytes_with<'life0, 'life1, 'async_trait>(
&'life0 mut self,
name: &'life1 str,
max: u64
) -> Pin<Box<dyn Future<Output = Result<Bytes, PayloadError>> + Send + 'async_trait>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
limits
only.Return with a Bytes by a limit representation of the request body.
fn text<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<String, PayloadError>> + Send + 'async_trait>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
'life0: 'async_trait,
Self: 'async_trait,
fn text<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<String, PayloadError>> + Send + 'async_trait>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
'life0: 'async_trait,
Self: 'async_trait,
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
Return with a Text representation of the request body.
fn form<'life0, 'async_trait, T>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<T, PayloadError>> + Send + 'async_trait>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
T: DeserializeOwned,
T: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn form<'life0, 'async_trait, T>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<T, PayloadError>> + Send + 'async_trait>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
T: DeserializeOwned,
T: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
form
only.Return with a application/x-www-form-urlencoded
FormData by the specified type
representation of the request body.
fn json<'life0, 'async_trait, T>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<T, PayloadError>> + Send + 'async_trait>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
T: DeserializeOwned,
T: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn json<'life0, 'async_trait, T>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<T, PayloadError>> + Send + 'async_trait>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
T: DeserializeOwned,
T: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
json
only.Return with a JSON by the specified type representation of the request body.
fn multipart<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<Multipart, PayloadError>> + Send + 'async_trait>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
'life0: 'async_trait,
Self: 'async_trait,
fn multipart<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<Multipart, PayloadError>> + Send + 'async_trait>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
'life0: 'async_trait,
Self: 'async_trait,
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
multipart
only.Return with a multipart/form-data
FormData by the specified type
representation of the request body.
data
only.Return a shared data by the specified type.
data
only.Store a shared data.
cookie
only.Get a wrapper of cookie-jar
for managing cookies.
cookie
only.Get a cookie by the specified name.
fn params<T>(&self) -> Result<T, ParamsError> where
T: DeserializeOwned,
fn params<T>(&self) -> Result<T, ParamsError> where
T: DeserializeOwned,
params
only.Get all parameters.