NormalizedParameter

Struct NormalizedParameter 

Source
pub struct NormalizedParameter { /* private fields */ }
Expand description

The query parameter normal form.

When a request wants to give access to its query or body parameters by reference, it can do so by a reference of the particular trait. But when the representation of the query is not stored in the memory associated with the request, it needs to be allocated to outlive the borrow on the request. This allocation may as well perform the minimization/normalization into a representation actually consumed by the backend. This normal form thus encapsulates the associated clone-into-normal form by various possible constructors from references [WIP].

This gives rise to a custom Cow<QueryParameter> instance by requiring that normalization into memory with unrelated lifetime is always possible.

Internally a hashmap but this may change due to optimizations.

Implementations§

Source§

impl NormalizedParameter

Source

pub fn new() -> Self

Create an empty map.

Source

pub fn insert_or_poison( &mut self, key: Cow<'static, str>, val: Cow<'static, str>, )

Insert a key-value-pair or mark key as dead if already present.

Since each key must appear at most once, we do not remove it from the map but instead mark the key as having a duplicate entry.

Trait Implementations§

Source§

impl Borrow<dyn QueryParameter> for NormalizedParameter

Source§

fn borrow(&self) -> &(dyn QueryParameter + 'static)

Immutably borrows from an owned value. Read more
Source§

impl Borrow<dyn QueryParameter + Send> for NormalizedParameter

Source§

fn borrow(&self) -> &(dyn QueryParameter + Send + 'static)

Immutably borrows from an owned value. Read more
Source§

impl Clone for NormalizedParameter

Source§

fn clone(&self) -> NormalizedParameter

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 NormalizedParameter

Source§

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

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

impl Default for NormalizedParameter

Source§

fn default() -> NormalizedParameter

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

impl<'de> Deserialize<'de> for NormalizedParameter

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<K, V> FromIterator<(K, V)> for NormalizedParameter
where K: Into<Cow<'static, str>>, V: Into<Cow<'static, str>>,

Source§

fn from_iter<T>(iter: T) -> Self
where T: IntoIterator<Item = (K, V)>,

Creates a value from an iterator. Read more
Source§

impl QueryParameter for NormalizedParameter

Source§

fn unique_value(&self, key: &str) -> Option<Cow<'_, str>>

Get the unique value associated with a key. Read more
Source§

fn normalize(&self) -> NormalizedParameter

Guarantees that one can grab an owned copy.

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

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

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