[][src]Trait oxide_auth::frontends::dev::QueryParameter

pub unsafe trait QueryParameter {
    fn unique_value(&self, key: &str) -> Option<Cow<str>>;
fn normalize(&self) -> NormalizedParameter; }

Allows access to the query parameters in an url or a body.

Use one of the listed implementations below. Since those may be a bit confusing due to their abundant use of generics, basically use any type of HashMap that maps 'str-likes' to a collection of other 'str-likes'. Popular instances may be:

  • HashMap<String, String>
  • HashMap<String, Vec<String>>
  • HashMap<Cow<'static, str>, Cow<'static, str>>

You should generally not have to implement this trait yourself, and if you do there are additional requirements on your implementation to guarantee standard conformance. Therefore the trait is marked as unsafe.

Required methods

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

Get the unique value associated with a key.

If there are multiple values, return None. This is very important to guarantee conformance to the RFC. Afaik it prevents potentially subverting validation middleware, order dependent processing, or simple confusion between different components who parse the query string from different ends.

fn normalize(&self) -> NormalizedParameter

Guarantees that one can grab an owned copy.

Loading content...

Trait Implementations

impl ToOwned for dyn QueryParameter[src]

type Owned = NormalizedParameter

The resulting type after obtaining ownership.

fn clone_into(&self, target: &mut Self::Owned)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

impl Borrow<dyn QueryParameter + 'static> for NormalizedParameter[src]

Implementations on Foreign Types

impl<K, V, S: BuildHasher> QueryParameter for HashMap<K, V, S> where
    K: Borrow<str> + Eq + Hash,
    V: UniqueValue + Eq + Hash
[src]

impl<K, V> QueryParameter for Vec<(K, V)> where
    K: Borrow<str> + Eq + Hash,
    V: Borrow<str> + Eq + Hash
[src]

impl<'a, Q: QueryParameter + 'a + ?Sized> QueryParameter for &'a Q[src]

impl<'a, Q: QueryParameter + 'a + ?Sized> QueryParameter for &'a mut Q[src]

Loading content...

Implementors

impl QueryParameter for NormalizedParameter[src]

Loading content...