Struct RequestHeaders

Source
pub struct RequestHeaders<'b, const N: usize> {
    pub http11: bool,
    pub method: Method,
    pub path: &'b str,
    pub headers: Headers<'b, N>,
}
Expand description

Request headers including the request line (method, path)

Fields§

§http11: bool

Whether the request is HTTP/1.1

§method: Method

The HTTP method

§path: &'b str

The request path

§headers: Headers<'b, N>

The headers

Implementations§

Source§

impl<'b, const N: usize> RequestHeaders<'b, N>

Source

pub async fn receive<R>( &mut self, buf: &'b mut [u8], input: R, exact: bool, ) -> Result<(&'b mut [u8], usize), Error<R::Error>>
where R: Read,

Parse the headers from the input stream

Source

pub fn resolve<E>(&self) -> Result<(ConnectionType, BodyType), Error<E>>

Resolve the connection type and body type from the headers

Source

pub async fn send<W>( &self, chunked_if_unspecified: bool, output: W, ) -> Result<(ConnectionType, BodyType), Error<W::Error>>
where W: Write,

Send the headers to the output stream, returning the connection type and body type

Source§

impl<const N: usize> RequestHeaders<'_, N>

Source

pub const fn new() -> Self

Source

pub fn is_ws_upgrade_request(&self) -> bool

A utility method to check if the request is a Websocket upgrade request

Trait Implementations§

Source§

impl<'b, const N: usize> Debug for RequestHeaders<'b, N>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<const N: usize> Default for RequestHeaders<'_, N>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<const N: usize> Display for RequestHeaders<'_, N>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'b, const N: usize> Freeze for RequestHeaders<'b, N>

§

impl<'b, const N: usize> RefUnwindSafe for RequestHeaders<'b, N>

§

impl<'b, const N: usize> Send for RequestHeaders<'b, N>

§

impl<'b, const N: usize> Sync for RequestHeaders<'b, N>

§

impl<'b, const N: usize> Unpin for RequestHeaders<'b, N>

§

impl<'b, const N: usize> UnwindSafe for RequestHeaders<'b, N>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.