Skip to main content

IncomingRequest

Struct IncomingRequest 

Source
pub struct IncomingRequest<'a, const HEADERS_COUNT: usize, const PATH_QUERY_COUNT: usize> { /* private fields */ }
Expand description

a structr for holding references to buffer bytes with zero copy cost

Implementations§

Source§

impl<'a, const HEADERS_COUNT: usize, const PATH_QUERY_COUNT: usize> IncomingRequest<'a, HEADERS_COUNT, PATH_QUERY_COUNT>

Source

pub fn get_total_headers_length(&self) -> usize

getting total headers length

Source

pub fn first_line(&self) -> &HttpFirstLine<'a>

first line

Source

pub fn headers(&self) -> &HttpHeaders<'a, HEADERS_COUNT>

get headers

Source

pub fn new( payload: &'a [u8], ) -> FormingRequestResult<'a, HEADERS_COUNT, PATH_QUERY_COUNT>

for creating new request from incoming bytes and returning back where the headers of this request is end or at what position

§return FormingRequestResult
Source

pub fn path(&'a self) -> &'a str

for getting the path of the incoming request

§return &str which ’a stands for the life of incoming request
Source

pub fn method(&self) -> &'a str

parsing incoming http method

Source

pub fn http_version(&self) -> &str

parsing incoming http version

Source

pub fn content_length(&self) -> Option<&usize>

getting content length in headers

Source

pub fn get_from_path_query(&self, key: &str) -> Option<&'a str>

getting data from path query for examples

  • http:://examples.com/posts?id=1 the key is id and the value is 1
  • http:://examples.com/posts?year=2024 the key is year and the value is 2024

Trait Implementations§

Source§

impl<'a, const HEADERS_COUNT: usize, const PATH_QUERY_COUNT: usize> Display for IncomingRequest<'a, HEADERS_COUNT, PATH_QUERY_COUNT>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, const HEADERS_COUNT: usize, const PATH_QUERY_COUNT: usize> Freeze for IncomingRequest<'a, HEADERS_COUNT, PATH_QUERY_COUNT>
where HttpRequest<'a, HEADERS_COUNT>: Freeze,

§

impl<'a, const HEADERS_COUNT: usize, const PATH_QUERY_COUNT: usize> RefUnwindSafe for IncomingRequest<'a, HEADERS_COUNT, PATH_QUERY_COUNT>
where HttpRequest<'a, HEADERS_COUNT>: RefUnwindSafe,

§

impl<'a, const HEADERS_COUNT: usize, const PATH_QUERY_COUNT: usize> Send for IncomingRequest<'a, HEADERS_COUNT, PATH_QUERY_COUNT>
where HttpRequest<'a, HEADERS_COUNT>: Send,

§

impl<'a, const HEADERS_COUNT: usize, const PATH_QUERY_COUNT: usize> Sync for IncomingRequest<'a, HEADERS_COUNT, PATH_QUERY_COUNT>
where HttpRequest<'a, HEADERS_COUNT>: Sync,

§

impl<'a, const HEADERS_COUNT: usize, const PATH_QUERY_COUNT: usize> Unpin for IncomingRequest<'a, HEADERS_COUNT, PATH_QUERY_COUNT>
where HttpRequest<'a, HEADERS_COUNT>: Unpin,

§

impl<'a, const HEADERS_COUNT: usize, const PATH_QUERY_COUNT: usize> UnsafeUnpin for IncomingRequest<'a, HEADERS_COUNT, PATH_QUERY_COUNT>
where HttpRequest<'a, HEADERS_COUNT>: UnsafeUnpin,

§

impl<'a, const HEADERS_COUNT: usize, const PATH_QUERY_COUNT: usize> UnwindSafe for IncomingRequest<'a, HEADERS_COUNT, PATH_QUERY_COUNT>
where HttpRequest<'a, HEADERS_COUNT>: UnwindSafe,

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more