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>) -> AssertionFailure
pub fn with_location(self, loc: CallerLocation) -> AssertionFailure
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()
Source§impl From<AssertionFailure> for TestFailure
impl From<AssertionFailure> for TestFailure
Source§fn from(a: AssertionFailure) -> Self
fn from(a: AssertionFailure) -> Self
Converts to this type from the input type.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more