pub trait Req<CustErr>: Sized {
    // Required methods
    fn as_query(&self) -> Option<&str>;
    fn to_content_type(&self) -> Option<Cow<'_, str>>;
    fn accepts(&self) -> Option<Cow<'_, str>>;
    fn referer(&self) -> Option<Cow<'_, str>>;
    fn try_into_bytes(
        self,
    ) -> impl Future<Output = Result<Bytes, ServerFnError<CustErr>>> + Send;
    fn try_into_string(
        self,
    ) -> impl Future<Output = Result<String, ServerFnError<CustErr>>> + Send;
    fn try_into_stream(
        self,
    ) -> Result<impl Stream<Item = Result<Bytes, ServerFnError>> + Send + 'static, ServerFnError<CustErr>>;
}
Expand description

Represents the request as received by the server.

Required Methods§

Source

fn as_query(&self) -> Option<&str>

Returns the query string of the request’s URL, starting after the ?.

Source

fn to_content_type(&self) -> Option<Cow<'_, str>>

Returns the Content-Type header, if any.

Source

fn accepts(&self) -> Option<Cow<'_, str>>

Returns the Accepts header, if any.

Source

fn referer(&self) -> Option<Cow<'_, str>>

Returns the Referer header, if any.

Source

fn try_into_bytes( self, ) -> impl Future<Output = Result<Bytes, ServerFnError<CustErr>>> + Send

Attempts to extract the body of the request into Bytes.

Source

fn try_into_string( self, ) -> impl Future<Output = Result<String, ServerFnError<CustErr>>> + Send

Attempts to convert the body of the request into a string.

Source

fn try_into_stream( self, ) -> Result<impl Stream<Item = Result<Bytes, ServerFnError>> + Send + 'static, ServerFnError<CustErr>>

Attempts to convert the body of the request into a stream of bytes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<CustErr> Req<CustErr> for BrowserMockReq
where CustErr: 'static,