Skip to main content

Assertion

Trait Assertion 

Source
pub trait Assertion:
    Debug
    + Display
    + Termination {
    // Required method
    fn test(&self) -> bool;

    // Provided methods
    fn should_fail(self) -> ShouldFail<Self>
       where Self: Sized { ... }
    fn unwrap(&self) { ... }
}
Expand description

An assertion that has been made about some object.

Required Methods§

Source

fn test(&self) -> bool

true if the assertion was true.

Provided Methods§

Source

fn should_fail(self) -> ShouldFail<Self>
where Self: Sized,

Wrap the assertion in ShouldFail, inverting its condition.

Source

fn unwrap(&self)

Panic if the assertion was false.

§Panics

See above.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§