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§
Sourcefn as_query(&self) -> Option<&str>
fn as_query(&self) -> Option<&str>
Returns the query string of the request’s URL, starting after the ?
.
Sourcefn to_content_type(&self) -> Option<Cow<'_, str>>
fn to_content_type(&self) -> Option<Cow<'_, str>>
Returns the Content-Type
header, if any.
Sourcefn try_into_bytes(
self,
) -> impl Future<Output = Result<Bytes, ServerFnError<CustErr>>> + Send
fn try_into_bytes( self, ) -> impl Future<Output = Result<Bytes, ServerFnError<CustErr>>> + Send
Attempts to extract the body of the request into Bytes
.
Sourcefn try_into_string(
self,
) -> impl Future<Output = Result<String, ServerFnError<CustErr>>> + Send
fn try_into_string( self, ) -> impl Future<Output = Result<String, ServerFnError<CustErr>>> + Send
Attempts to convert the body of the request into a string.
Sourcefn try_into_stream(
self,
) -> Result<impl Stream<Item = Result<Bytes, ServerFnError>> + Send + 'static, ServerFnError<CustErr>>
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.