Struct ParameterList

Source
pub struct ParameterList<K, V, A = Vec<(K, V)>, P = (K, V)> { /* private fields */ }
Expand description

A Request with dynamic list of key-value parameter pairs.

This is like an array of (K, V) but the parameters are guaranteed to be sorted alphabetically.

§Example

let request = oauth::ParameterList::new([
   ("foo", 123),
   ("bar", 23),
   ("foo", 3),
]);

let form = oauth::to_form(&request);
assert_eq!(form, "bar=23&foo=123&foo=3");

Implementations§

Source§

impl<K, V, A, P> ParameterList<K, V, A, P>
where K: AsRef<str>, V: Display, A: AsRef<[P]>, P: Borrow<(K, V)>,

Source

pub fn from_sorted(list: A) -> Option<Self>

Creates a new ParameterList from sorted list.

Returns None if list is not sorted.

Source§

impl<K, V, A, P> ParameterList<K, V, A, P>
where K: AsRef<str>, V: Display, A: AsRef<[P]> + AsMut<[P]>, P: Borrow<(K, V)>,

Source

pub fn new(list: A) -> Self

Creates a new ParameterList from list.

This function sorts list.

Source§

impl<K, V, A, P> ParameterList<K, V, A, P>

Source

pub fn into_inner(self) -> A

Consumes the ParameterList, returning the wrapped value.

Source§

impl<K, V, A, P> ParameterList<K, V, A, P>
where A: AsRef<[P]>, P: Borrow<(K, V)>,

Source

pub fn iter(&self) -> Iter<'_, K, V, P>

Returns an iterator over entries of the ParameterList.

Trait Implementations§

Source§

impl<K, V, A, P> AsRef<[P]> for ParameterList<K, V, A, P>
where A: AsRef<[P]>,

Source§

fn as_ref(&self) -> &[P]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<K, V, A, P> Default for ParameterList<K, V, A, P>
where K: AsRef<str>, V: Display, A: AsRef<[P]> + Default, P: Borrow<(K, V)>,

Source§

fn default() -> Self

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

impl<K, V, A, P> Extend<P> for ParameterList<K, V, A, P>
where K: AsRef<str>, V: Display, A: AsMut<[P]> + Extend<P>, P: Borrow<(K, V)>,

Source§

fn extend<I>(&mut self, iter: I)
where I: IntoIterator<Item = P>,

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<K, V, A, P> From<A> for ParameterList<K, V, A, P>
where K: AsRef<str>, V: Display, A: AsRef<[P]> + AsMut<[P]>, P: Borrow<(K, V)>,

Source§

fn from(list: A) -> Self

Converts to this type from the input type.
Source§

impl<K, V, A, P> FromIterator<P> for ParameterList<K, V, A, P>
where K: AsRef<str>, V: Display, A: AsRef<[P]> + AsMut<[P]> + FromIterator<P>, P: Borrow<(K, V)>,

Source§

fn from_iter<I>(iter: I) -> Self
where I: IntoIterator<Item = P>,

Creates a value from an iterator. Read more
Source§

impl<K, V, A, P> Request for ParameterList<K, V, A, P>
where K: AsRef<str>, V: Display, A: AsRef<[P]>, P: Borrow<(K, V)>,

Source§

fn serialize<S>(&self, serializer: S) -> S::Output
where S: Serializer,

Feeds a Serializer implementation with the key-value pairs of the request and returns the serializer’s output.

Auto Trait Implementations§

§

impl<K, V, A, P> Freeze for ParameterList<K, V, A, P>
where A: Freeze,

§

impl<K, V, A, P> RefUnwindSafe for ParameterList<K, V, A, P>
where A: RefUnwindSafe,

§

impl<K, V, A, P> Send for ParameterList<K, V, A, P>
where A: Send,

§

impl<K, V, A, P> Sync for ParameterList<K, V, A, P>
where A: Sync,

§

impl<K, V, A, P> Unpin for ParameterList<K, V, A, P>
where A: Unpin,

§

impl<K, V, A, P> UnwindSafe for ParameterList<K, V, A, P>
where A: 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, 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, 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