pub struct Assertion(/* private fields */);
Expand description
An assertion.
Implementations§
Source§impl Assertion
impl Assertion
Sourcepub fn repeat(&self) -> Self
pub fn repeat(&self) -> Self
Create a new assertion with the same condition.
use tracing_subscriber::layer::SubscriberExt;
let asserter = tracing_assertions::Layer::default();
let registry = tracing_subscriber::Registry::default();
let subscriber = registry.with(asserter.clone());
let guard = tracing::subscriber::set_default(subscriber);
let one = asserter.matches("one");
tracing::info!("one");
one.assert();
let one2 = one.repeat();
(!&one2).assert();
tracing::info!("one");
one2.assert();
§Panics
When the inner mutex is poisoned.
Sourcepub fn reset(&self)
pub fn reset(&self)
Resets the assertion.
use tracing_subscriber::layer::SubscriberExt;
let asserter = tracing_assertions::Layer::default();
let registry = tracing_subscriber::Registry::default();
let subscriber = registry.with(asserter.clone());
let guard = tracing::subscriber::set_default(subscriber);
let one = asserter.matches("one");
tracing::info!("one");
one.assert().reset();
(!&one).assert();
tracing::info!("one");
one.assert();
§Panics
When the inner mutex is poisoned.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Assertion
impl RefUnwindSafe for Assertion
impl Send for Assertion
impl Sync for Assertion
impl Unpin for Assertion
impl UnwindSafe for Assertion
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