pub struct AssertionFailure {
pub message: String,
pub diff: Option<String>,
pub location: Option<CallerLocation>,
}Expand description
Failure produced by a synchronous value matcher.
message is the formatted, JS-ready failure body (already includes
the diff inline so the rquickjs error and a Rust panic carry the
same text). diff is the same diff in isolation — handy for
reporters that want to colorize / re-render it. location is the
#[track_caller] site that invoked the matcher; the test-runner
adapter splices it into the printed failure.
Fields§
§message: String§diff: Option<String>§location: Option<CallerLocation>Implementations§
Source§impl AssertionFailure
impl AssertionFailure
pub fn new(message: impl Into<String>, diff: Option<String>) -> Self
pub fn with_location(self, loc: CallerLocation) -> Self
Trait Implementations§
Source§impl Clone for AssertionFailure
impl Clone for AssertionFailure
Source§fn clone(&self) -> AssertionFailure
fn clone(&self) -> AssertionFailure
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AssertionFailure
impl Debug for AssertionFailure
Source§impl Display for AssertionFailure
impl Display for AssertionFailure
Source§impl Error for AssertionFailure
impl Error for AssertionFailure
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for AssertionFailure
impl RefUnwindSafe for AssertionFailure
impl Send for AssertionFailure
impl Sync for AssertionFailure
impl Unpin for AssertionFailure
impl UnsafeUnpin for AssertionFailure
impl UnwindSafe for AssertionFailure
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more