pub trait Expectation<S: ?Sized> {
// Required methods
fn test(&mut self, subject: &S) -> bool;
fn message(
&self,
expression: Expression<'_>,
actual: &S,
format: &DiffFormat,
) -> String;
}Expand description
An expectation defines a test for a property of the asserted subject.
It requires two methods: a test() method and a message() method.
The test() method is called to verify whether an actual subject meets the
expected property. In case the test of the expectation fails the message()
method is called to form an expectation specific failure message.
Required Methods§
Sourcefn test(&mut self, subject: &S) -> bool
fn test(&mut self, subject: &S) -> bool
Verifies whether the actual subject fulfills the expected property.
Sourcefn message(
&self,
expression: Expression<'_>,
actual: &S,
format: &DiffFormat,
) -> String
fn message( &self, expression: Expression<'_>, actual: &S, format: &DiffFormat, ) -> String
Forms a failure message for this expectation.