Skip to main content

RequestData

Struct RequestData 

Source
pub struct RequestData {
    pub path_params: Arc<HashMap<String, String>>,
    pub query_params: Value,
    pub validated_params: Option<Value>,
    pub raw_query_params: Arc<HashMap<String, Vec<String>>>,
    pub body: Value,
    pub raw_body: Option<Vec<u8>>,
    pub headers: Arc<HashMap<String, String>>,
    pub cookies: Arc<HashMap<String, String>>,
    pub method: String,
    pub path: String,
}
Expand description

Request data extracted from HTTP request

This is the language-agnostic representation passed to handlers.

Uses Arc for HashMaps to enable cheap cloning without duplicating data. When RequestData is cloned, only the Arc pointers are cloned, not the underlying data.

Performance optimization: raw_body stores the unparsed request body bytes. Language bindings should use raw_body when possible to avoid double-parsing. The body field is lazily parsed only when needed for validation.

Fields§

§path_params: Arc<HashMap<String, String>>

Path parameters extracted from the URL path

§query_params: Value

Query parameters parsed as JSON

§validated_params: Option<Value>

Validated parameters produced by ParameterValidator (query/path/header/cookie combined).

§raw_query_params: Arc<HashMap<String, Vec<String>>>

Raw query parameters as key-value pairs

§body: Value

Parsed request body as JSON

§raw_body: Option<Vec<u8>>§headers: Arc<HashMap<String, String>>

Request headers

§cookies: Arc<HashMap<String, String>>

Request cookies

§method: String

HTTP method (GET, POST, etc.)

§path: String

Request path

Trait Implementations§

Source§

impl Clone for RequestData

Source§

fn clone(&self) -> RequestData

Returns a duplicate 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 RequestData

Source§

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

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

impl<'de> Deserialize<'de> for RequestData

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for RequestData

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

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§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

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

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

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,