pub trait SetAssertion<'a, S, T, R> {
// Required methods
fn has_length(&self, length: usize) -> R;
fn is_empty(&self) -> R
where T: Debug;
fn contains<B: Borrow<T>>(&self, expected: B) -> R
where T: PartialEq + Eq + Debug + Hash;
fn does_not_contain<B>(&self, element: B) -> R
where B: Borrow<T>,
T: PartialEq + Debug;
fn does_not_contain_any<B: Borrow<Vec<T>>>(&self, elements: B) -> R
where T: PartialEq + Debug;
}Expand description
Trait for set assertion.
§Example
use assertor::*;
use std::collections::HashSet;
let mut set = HashSet::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);ⓘ
use assertor::*;
use std::collections::HashSet;
let mut set = HashSet::new();
set.insert("a");
assert_that!(set).contains("z");
// expected to contain : "z"
// but did not
// though it did contain: ["a"]Required Methods§
Sourcefn has_length(&self, length: usize) -> R
fn has_length(&self, length: usize) -> R
Checks that the subject has the given length.
Sourcefn does_not_contain<B>(&self, element: B) -> R
fn does_not_contain<B>(&self, element: B) -> R
Checks that the subject does not contain element.
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.