pub trait DefinitelySame {
// Required method
fn definitely_same(&self, other: &Self) -> bool;
}Expand description
The DefinitelySame trait is a helper trait implemented because Errors do not generically implement PartialEq. This is a bit of a drag for testing since it’s nice to be able to check if an error matches the one that’s expected. DefinitelySame addresses this by providing a weak equivalence test: definitely_same() returns true if the two values definitely are equivalent, and false otherwise. This can happen if the value are known to be different, but also if we can’t tell. It doesn’t cover all cases, but it does cover the ones that come up in our test suite.
Required Methods§
fn definitely_same(&self, other: &Self) -> bool
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl DefinitelySame for Box<dyn Error + Send>
impl DefinitelySame for Box<dyn Error + Send>
Source§fn definitely_same(&self, other: &Self) -> bool
fn definitely_same(&self, other: &Self) -> bool
Hack alert! We only compare stringifications.
Source§impl DefinitelySame for Error
impl DefinitelySame for Error
Source§fn definitely_same(&self, other: &Self) -> bool
fn definitely_same(&self, other: &Self) -> bool
Hack alert! We only compare stringifications.