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§
Source§impl<I: Clone> Clone for AssertSorted<I>
impl<I: Clone> Clone for AssertSorted<I>
Source§fn clone(&self) -> AssertSorted<I>
fn clone(&self) -> AssertSorted<I>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<I: Debug> Debug for AssertSorted<I>
impl<I: Debug> Debug for AssertSorted<I>
Source§impl<I: Default> Default for AssertSorted<I>
impl<I: Default> Default for AssertSorted<I>
Source§fn default() -> AssertSorted<I>
fn default() -> AssertSorted<I>
Returns the “default value” for a type. Read more
Source§impl<I, K, V> Request for AssertSorted<I>
impl<I, K, V> Request for AssertSorted<I>
Source§fn serialize<S>(&self, serializer: S) -> S::Outputwhere
S: Serializer,
fn serialize<S>(&self, serializer: S) -> S::Outputwhere
S: Serializer,
Feeds a
Serializer
implementation with the key-value pairs of the request
and returns the serializer’s output.impl<I: Copy> Copy for AssertSorted<I>
Auto Trait Implementations§
impl<I> Freeze for AssertSorted<I>where
I: Freeze,
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§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more