Trait viz_core::RequestExt

source ·
pub trait RequestExt: Sized {
Show 24 methods fn schema(&self) -> Option<&Scheme>; 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>>
    where
        T: FromRequest + 'async_trait,
        Self: 'async_trait,
        'life0: 'async_trait
; fn bytes<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<Bytes, PayloadError>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: '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>>
    where
        Self: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait
; fn text<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<String, PayloadError>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait
; fn form<'life0, 'async_trait, T>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<T, PayloadError>> + Send + 'async_trait>>
    where
        T: DeserializeOwned + 'async_trait,
        Self: 'async_trait,
        'life0: 'async_trait
; fn json<'life0, 'async_trait, T>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<T, PayloadError>> + Send + 'async_trait>>
    where
        T: DeserializeOwned + 'async_trait,
        Self: 'async_trait,
        'life0: 'async_trait
; fn multipart<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<Multipart, PayloadError>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait
; fn state<T>(&self) -> Option<T>
    where
        T: Clone + Send + Sync + 'static
; fn set_state<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
; fn route_info(&self) -> &Arc<RouteInfo>; fn remote_addr(&self) -> Option<&SocketAddr>;
}
Expand description

The Request Extension.

Required Methods§

Get URL’s schema of this request.

Get URL’s path of this request.

Get URL’s query string of this request.

Available on crate feature query only.

Get query data by type.

Get a header with the specified type by the key.

Get the size of this request’s body.

Get the media type of this request.

Extract the data from this request by the specified type.

Return with a Bytes representation of the request body.

Available on crate feature limits only.

Return with a Bytes by a limit representation of the request body.

Return with a Text representation of the request body.

Available on crate feature form only.

Return with a application/x-www-form-urlencoded FormData by the specified type representation of the request body.

Available on crate feature json only.

Return with a JSON by the specified type representation of the request body.

Available on crate feature multipart only.

Return with a multipart/form-data FormData by the specified type representation of the request body.

Available on crate feature state only.

Return a shared state by the specified type.

Available on crate feature state only.

Store a shared state.

Available on crate feature cookie only.

Get a wrapper of cookie-jar for managing cookies.

Available on crate feature cookie only.

Get a cookie by the specified name.

Available on crate feature limits only.

Get limits settings.

Available on crate feature session only.

Get current session.

Available on crate feature params only.

Get all parameters.

Available on crate feature params only.

Get single parameter by name.

Get current route.

Get remote addr.

Implementors§