pub trait ExpectProjection<'e, F, T, U, B>{
// Required method
fn projected_by(self, projection: F, config: impl FnOnce(B) -> B) -> Self;
}Required Methods§
Sourcefn projected_by(self, projection: F, config: impl FnOnce(B) -> B) -> Self
fn projected_by(self, projection: F, config: impl FnOnce(B) -> B) -> Self
Add expectations on a projected value
use rxpect::expect;
use rxpect::expectations::EqualityExpectations;
use rxpect::ExpectProjection;
#[derive(Debug)]
pub struct MyStruct {
pub foo: u32
}
expect(MyStruct{ foo: 7 }).projected_by(|it| it.foo, |foo| foo
.to_equal(7)
);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.