OrderedMapAssertion

Trait OrderedMapAssertion 

Source
pub trait OrderedMapAssertion<'a, K: 'a + Ord + Eq, V, ML, R>: MapAssertion<'a, K, V, ML, R>
where AssertionResult: AssertionStrategy<R>, ML: OrderedMapLike<K, V>,
{ // Required methods fn contains_exactly_in_order<BM, OML>(&self, expected: BM) -> R where K: Eq + Ord + Debug, V: Eq + Debug, OML: OrderedMapLike<K, V> + 'a, BM: Borrow<OML> + 'a; fn contains_all_of_in_order<BM, OML>(&self, expected: BM) -> R where K: Eq + Ord + Debug, V: Eq + Debug, OML: OrderedMapLike<K, V> + 'a, BM: Borrow<OML> + 'a; }
Expand description

Trait for ordered map assertion.

§Example

use std::collections::BTreeMap;
use assertor::*;

let mut map = BTreeMap::new();
assert_that!(map).is_empty();

map.insert("one", 1);
map.insert("two", 2);
map.insert("three", 3);

assert_that!(map).has_length(3);
assert_that!(map).contains_key("one");
assert_that!(map).key_set().contains_exactly(vec!["three","two","one"].iter());
assert_that!(map).contains_all_of_in_order(BTreeMap::from([("one", 1), ("three", 3)]));

Required Methods§

Source

fn contains_exactly_in_order<BM, OML>(&self, expected: BM) -> R
where K: Eq + Ord + Debug, V: Eq + Debug, OML: OrderedMapLike<K, V> + 'a, BM: Borrow<OML> + 'a,

Checks that the subject exactly contains expected in the same order.

Source

fn contains_all_of_in_order<BM, OML>(&self, expected: BM) -> R
where K: Eq + Ord + Debug, V: Eq + Debug, OML: OrderedMapLike<K, V> + 'a, BM: Borrow<OML> + 'a,

Checks that the subject contains at least all elements of expected in the same order.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'a, K, V, ML, R> OrderedMapAssertion<'a, K, V, ML, R> for Subject<'a, ML, (), R>
where AssertionResult: AssertionStrategy<R>, K: 'a + Eq + Ord, ML: OrderedMapLike<K, V>,