Struct oauth1_request::request::AssertSorted
source · [−]pub struct AssertSorted<I> { /* private fields */ }
Expand description
A wrapper type that implements Request
with key-value pairs returned by the wrapped
iterator.
The key-value pairs must be sorted as required by the Serializer
trait. Otherwise, the
behavior of this wrapper is unspecified.
Note that the required ordering is alphabetical ordering of AsRef<str>
value of the key and
Display
representation of the value and does not necessarily match that of the one provided by
the Ord
trait, which may provide, for example, numerical ordering instead.
If you have a slice instead of an iterator, consider using ParameterList
, which guarantees
the correct ordering.
Example
use std::collections::BTreeMap;
let request = BTreeMap::from_iter([
("article_id", "123456789"),
("text", "A request signed with OAuth & Rust 🦀 🔏"),
]);
let request = oauth::request::AssertSorted::new(&request);
let form = oauth::to_form(&request);
assert_eq!(
form,
"article_id=123456789&text=A%20request%20signed%20with%20OAuth%20%26%20Rust%20%F0%9F%A6%80%20%F0%9F%94%8F",
);
Implementations
Trait Implementations
sourceimpl<I: Clone> Clone for AssertSorted<I>
impl<I: Clone> Clone for AssertSorted<I>
sourcefn clone(&self) -> AssertSorted<I>
fn clone(&self) -> AssertSorted<I>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<I: Debug> Debug for AssertSorted<I>
impl<I: Debug> Debug for AssertSorted<I>
sourceimpl<I: Default> Default for AssertSorted<I>
impl<I: Default> Default for AssertSorted<I>
sourcefn default() -> AssertSorted<I>
fn default() -> AssertSorted<I>
Returns the “default value” for a type. Read more
sourceimpl<I, K, V> Request for AssertSorted<I> where
I: Clone + Iterator<Item = (K, V)>,
K: AsRef<str>,
V: Display,
impl<I, K, V> Request for AssertSorted<I> where
I: Clone + Iterator<Item = (K, V)>,
K: AsRef<str>,
V: Display,
sourcefn serialize<S>(&self, serializer: S) -> S::Output where
S: Serializer,
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. Read more
impl<I: Copy> Copy for AssertSorted<I>
Auto Trait Implementations
impl<I> RefUnwindSafe for AssertSorted<I> where
I: RefUnwindSafe,
impl<I> Send for AssertSorted<I> where
I: Send,
impl<I> Sync for AssertSorted<I> where
I: Sync,
impl<I> Unpin for AssertSorted<I> where
I: Unpin,
impl<I> UnwindSafe for AssertSorted<I> where
I: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more