Trait Req
pub trait Req<Error, InputStreamError = Error, OutputStreamError = Error>: Sized {
type WebsocketResponse: Send;
// 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, Error>> + Send;
fn try_into_string(
self,
) -> impl Future<Output = Result<String, Error>> + Send;
fn try_into_stream(
self,
) -> Result<impl Stream<Item = Result<Bytes, Bytes>> + Send + 'static, Error>;
fn try_into_websocket(
self,
) -> impl Future<Output = Result<(impl Stream<Item = Result<Bytes, Bytes>> + Send + 'static, impl Sink<Bytes> + Send + 'static, Self::WebsocketResponse), Error>> + Send;
}
Expand description
Represents the request as received by the server.
Required Associated Types§
type WebsocketResponse: Send
type WebsocketResponse: Send
The response type for websockets.
Required Methods§
fn as_query(&self) -> Option<&str>
fn as_query(&self) -> Option<&str>
Returns the query string of the request’s URL, starting after the ?
.
fn to_content_type(&self) -> Option<Cow<'_, str>>
fn to_content_type(&self) -> Option<Cow<'_, str>>
Returns the Content-Type
header, if any.
fn try_into_bytes(self) -> impl Future<Output = Result<Bytes, Error>> + Send
fn try_into_bytes(self) -> impl Future<Output = Result<Bytes, Error>> + Send
Attempts to extract the body of the request into Bytes
.
fn try_into_string(self) -> impl Future<Output = Result<String, Error>> + Send
fn try_into_string(self) -> impl Future<Output = Result<String, Error>> + Send
Attempts to convert the body of the request into a string.
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.