Skip to main content

Request

Struct Request 

Source
pub struct Request {
    pub method: String,
    pub path: String,
    pub body: Vec<u8>,
    pub request_id: [u8; 16],
    pub trace_id: [u8; 16],
    pub headers: Vec<Header>,
    pub conn: ConnInfo,
}
Expand description

Request represents an inbound NWEP request delivered to a Handler.

The request is constructed by the event loop from the C library’s nwep_request struct and passed (together with a ResponseWriter) to Handler::serve.

Fields§

§method: String

NWEP method string (e.g. "read" or "write").

§path: String

Request path (e.g. "/hello").

§body: Vec<u8>

Request body bytes.

§request_id: [u8; 16]

16-byte opaque request identifier generated by the client.

§trace_id: [u8; 16]

16-byte opaque trace identifier for distributed tracing.

§headers: Vec<Header>

Custom headers sent by the client.

§conn: ConnInfo

Identity and role of the peer that sent this request.

Implementations§

Source§

impl Request

Source

pub fn header(&self, name: &str) -> Option<&str>

header looks up a request header by name, returning its value if present.

Auto Trait Implementations§

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.