pub trait ActionAssertions<A> {
// Required methods
fn assert_empty(&self);
fn assert_not_empty(&self);
fn assert_count(&self, n: usize);
fn assert_first_matches<F>(&self, f: F)
where F: Fn(&A) -> bool;
fn assert_any_matches<F>(&self, f: F)
where F: Fn(&A) -> bool;
fn assert_all_match<F>(&self, f: F)
where F: Fn(&A) -> bool;
fn assert_none_match<F>(&self, f: F)
where F: Fn(&A) -> bool;
}Expand description
Fluent assertion trait for action vectors.
This trait only requires Debug, making it usable with any action type.
For equality-based assertions (like assert_first), use ActionAssertionsEq.
§Example
ⓘ
use tui_dispatch::testing::ActionAssertions;
let actions = harness.drain_emitted();
actions.assert_not_empty();
actions.assert_count(3);
actions.assert_any_matches(|a| matches!(a, Action::SelectKey(i) if *i > 0));Required Methods§
Sourcefn assert_empty(&self)
fn assert_empty(&self)
Sourcefn assert_not_empty(&self)
fn assert_not_empty(&self)
Sourcefn assert_count(&self, n: usize)
fn assert_count(&self, n: usize)
Sourcefn assert_first_matches<F>(&self, f: F)
fn assert_first_matches<F>(&self, f: F)
Assert that the first action matches a predicate.
§Panics
Panics if the vector is empty or the predicate returns false.
Sourcefn assert_any_matches<F>(&self, f: F)
fn assert_any_matches<F>(&self, f: F)
Sourcefn assert_all_match<F>(&self, f: F)
fn assert_all_match<F>(&self, f: F)
Assert that all actions match a predicate.
§Panics
Panics if any action doesn’t match the predicate.
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.