pub struct MockHandle(/* private fields */);
Expand description
A handle which is used to invoke validation of expectations.
The handle is currently only used to assert that all the expected events and spans were seen.
For additional information and examples, see the collector
module documentation.
Implementations§
Source§impl MockHandle
impl MockHandle
Sourcepub fn assert_finished(&self)
pub fn assert_finished(&self)
Checks the expectations which were set on the
MockCollector
.
Calling assert_finished
is usually the final part of a test.
§Panics
This method will panic if any of the provided expectations are not met.
§Examples
use tracing_mock::{collector, expect};
let (collector, handle) = collector::mock()
.event(expect::event())
.run_with_handle();
tracing::collect::with_default(collector, || {
tracing::info!("a");
});
// Check assertions set on the mock collector
handle.assert_finished();
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MockHandle
impl RefUnwindSafe for MockHandle
impl Send for MockHandle
impl Sync for MockHandle
impl Unpin for MockHandle
impl UnwindSafe for MockHandle
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