Skip to main content

SoftScope

Struct SoftScope 

Source
pub struct SoftScope<'a> { /* private fields */ }
Expand description

A context sub-scope of a SoftAsserter, returned by SoftAsserter::context.

Recording through a SoftScope behaves exactly like recording through the underlying SoftAsserter, except every recorded failure also carries the scope’s context frame (and the frames of any enclosing scopes). Dropping the SoftScope removes its frame, so the context applies only to failures recorded while the scope is alive.

Implementations§

Source§

impl SoftScope<'_>

Source

pub fn check<T, M>(&mut self, actual: &T, matcher: M)
where M: Matcher<T>, T: ?Sized,

Records whether actual satisfies matcher, attaching this scope’s context to a miss. See SoftAsserter::check.

Source

pub fn record(&mut self, result: Result<(), TestError>)

Records the result of a fallible step, attaching this scope’s context to an Err. See SoftAsserter::record.

Source

pub fn context( &mut self, message: impl Into<Cow<'static, str>>, ) -> SoftScope<'_>

Opens a nested context sub-scope. Its frame stacks under this scope’s, so failures recorded through it carry both. See SoftAsserter::context.

Trait Implementations§

Source§

impl Drop for SoftScope<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for SoftScope<'a>

§

impl<'a> !RefUnwindSafe for SoftScope<'a>

§

impl<'a> Send for SoftScope<'a>

§

impl<'a> Sync for SoftScope<'a>

§

impl<'a> Unpin for SoftScope<'a>

§

impl<'a> UnsafeUnpin for SoftScope<'a>

§

impl<'a> !UnwindSafe for SoftScope<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> RuntimeAvailable for T
where T: ?Sized,