Struct tinyhttp_internal::request::Request

source ·
pub struct Request { /* private fields */ }
Expand description

Struct containing data on a single request.

parsed_body which is a Option that can contain the body as a String

body is used when the body of the request is not a String

Implementations§

source§

impl Request

source

pub fn new( body: Vec<u8>, raw_headers: HashMap<String, String>, status_line: Vec<String>, wildcard: Option<String>, ) -> Request

source

pub fn get_raw_body(&self) -> &[u8]

Get request body as bytes

source

pub fn get_parsed_body(&self) -> Option<&str>

Get request body as a string

source

pub fn get_headers(&self) -> &HashMap<String, String>

Get request headers in a HashMap

source

pub fn get_status_line(&self) -> &[String]

Get status line of request

source

pub fn get_wildcard(&self) -> Option<&String>

source

pub fn get_http2(&self) -> bool

source

pub fn set_http2(self, w: bool) -> Self

Trait Implementations§

source§

impl Clone for Request

source§

fn clone(&self) -> Request

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Request

source§

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

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

impl Default for Request

source§

fn default() -> Request

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

impl<'a> From<&'a mut Request> for &'a [u8]

source§

fn from(value: &'a mut Request) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a mut Request> for &'a HashMap<String, String>

source§

fn from(value: &'a mut Request) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a mut Request> for Option<&'a str>

source§

fn from(value: &'a mut Request) -> Self

Converts to this type from the input type.
source§

impl From<&mut Request> for Request

source§

fn from(value: &mut Request) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a mut Request> for Wildcard<&'a str>

source§

fn from(value: &'a mut Request) -> Self

Converts to this type from the input type.

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> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.