Trait OrderedSetAssertion

Source
pub trait OrderedSetAssertion<'a, ST, T, R>: SetAssertion<'a, ST, T, R>
where AssertionResult: AssertionStrategy<R>, T: PartialOrd + Eq + Debug, ST: OrderedSetLike<T>,
{ // Required methods fn contains_all_of_in_order<OSA, OS>(&self, expected: OSA) -> R where T: PartialOrd + Eq + Debug, OS: OrderedSetLike<T>, OSA: Borrow<OS>; fn contains_exactly_in_order<OSA, OS>(&self, expected: OSA) -> R where T: PartialOrd + Eq + Debug, OS: OrderedSetLike<T>, OSA: Borrow<OS>; }
Expand description

Trait for sorted set assertions.

§Example

use assertor::*;
use std::collections::BTreeSet;

let mut set = BTreeSet::new();
assert_that!(set).is_empty();

set.insert("a");
set.insert("b");
set.insert("c");

assert_that!(set).contains("a");
assert_that!(set).has_length(3);
assert_that!(set).contains_all_of_in_order(BTreeSet::from(["b", "c"]));
use assertor::*;
use std::collections::BTreeSet;

let mut set = BTreeSet::new();
set.insert("a");
assert_that!(set).contains("z");
// expected to contain  : "z"
// but did not
// though it did contain: ["a"]

Required Methods§

Source

fn contains_all_of_in_order<OSA, OS>(&self, expected: OSA) -> R
where T: PartialOrd + Eq + Debug, OS: OrderedSetLike<T>, OSA: Borrow<OS>,

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

§Example
use assertor::*;
use std::collections::BTreeSet;
assert_that!(BTreeSet::from([1, 2, 3])).contains_all_of_in_order(BTreeSet::from([1, 2, 3]));
Source

fn contains_exactly_in_order<OSA, OS>(&self, expected: OSA) -> R
where T: PartialOrd + Eq + Debug, OS: OrderedSetLike<T>, OSA: Borrow<OS>,

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

§Example
use assertor::*;
use std::collections::BTreeSet;
assert_that!(BTreeSet::from([1, 2, 3])).contains_exactly_in_order(BTreeSet::from([1, 2, 3]));

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, T, R, ST> OrderedSetAssertion<'a, ST, T, R> for Subject<'a, ST, (), R>
where AssertionResult: AssertionStrategy<R>, T: Eq + PartialOrd + Debug, ST: OrderedSetLike<T>,