pub trait EffectAssertions<E> {
// Required methods
fn effects_empty(&self);
fn effects_not_empty(&self);
fn effects_count(&self, n: usize);
fn effects_any_matches<F: Fn(&E) -> bool>(&self, f: F);
fn effects_first_matches<F: Fn(&E) -> bool>(&self, f: F);
fn effects_all_match<F: Fn(&E) -> bool>(&self, f: F);
fn effects_none_match<F: Fn(&E) -> bool>(&self, f: F);
}Expand description
Fluent assertions for effect vectors.
Method names are prefixed with effects_ to avoid conflicts with
ActionAssertions when both traits are in scope.
§Example
ⓘ
use tui_dispatch::testing::EffectAssertions;
let effects = harness.drain_effects();
effects.effects_count(1);
effects.effects_first_matches(|e| matches!(e, Effect::FetchWeather { .. }));Required Methods§
Sourcefn effects_empty(&self)
fn effects_empty(&self)
Assert the effect vector is empty.
Sourcefn effects_not_empty(&self)
fn effects_not_empty(&self)
Assert the effect vector is not empty.
Sourcefn effects_count(&self, n: usize)
fn effects_count(&self, n: usize)
Assert the effect vector has exactly n elements.
Sourcefn effects_any_matches<F: Fn(&E) -> bool>(&self, f: F)
fn effects_any_matches<F: Fn(&E) -> bool>(&self, f: F)
Assert any effect matches the predicate.
Sourcefn effects_first_matches<F: Fn(&E) -> bool>(&self, f: F)
fn effects_first_matches<F: Fn(&E) -> bool>(&self, f: F)
Assert the first effect matches the predicate.
Sourcefn effects_all_match<F: Fn(&E) -> bool>(&self, f: F)
fn effects_all_match<F: Fn(&E) -> bool>(&self, f: F)
Assert all effects match the predicate.
Sourcefn effects_none_match<F: Fn(&E) -> bool>(&self, f: F)
fn effects_none_match<F: Fn(&E) -> bool>(&self, f: F)
Assert no effects 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.