pub struct AssertionBuilder<S> { /* private fields */ }
Expand description
Configures and constructs an Assertion
.
This builder uses a state pattern to ensure that the necessary fields are configured before a
valid Assertion
can be constructed. You may notice that some methods are only available once
other methods have been called.
You must first define a span matcher, which defines how this assertion is matched to a given span, and then you must specify the assertion criteria itself, which defines the behavior of the span to assert for.
Once these are defined, an Assertion
can be constructed by calling [finalize
].
Implementations
sourceimpl AssertionBuilder<NoMatcher>
impl AssertionBuilder<NoMatcher>
sourcepub fn with_name<S>(self, name: S) -> AssertionBuilder<NoCriteria> where
S: Into<String>,
pub fn with_name<S>(self, name: S) -> AssertionBuilder<NoCriteria> where
S: Into<String>,
Sets the name of the span to match.
All span matchers, which includes [with_name
], [with_target
], [with_parent_name
], and
[with_span_field
], are additive, which means a span must match all of them to match the
assertion overall.
sourcepub fn with_target<S>(self, target: S) -> AssertionBuilder<NoCriteria> where
S: Into<String>,
pub fn with_target<S>(self, target: S) -> AssertionBuilder<NoCriteria> where
S: Into<String>,
Sets the target of the span to match.
All span matchers, which includes [with_name
], [with_target
], [with_parent_name
], and
[with_span_field
], are additive, which means a span must match all of them to match the
assertion overall.
sourceimpl AssertionBuilder<NoCriteria>
impl AssertionBuilder<NoCriteria>
sourcepub fn with_name<S>(self, name: S) -> AssertionBuilder<NoCriteria> where
S: Into<String>,
pub fn with_name<S>(self, name: S) -> AssertionBuilder<NoCriteria> where
S: Into<String>,
Sets the name of the span to match.
All span matchers, which includes [with_name
], [with_target
], [with_parent_name
], and
[with_span_field
], are additive, which means a span must match all of them to match the
assertion overall.
sourcepub fn with_target<S>(self, target: S) -> AssertionBuilder<NoCriteria> where
S: Into<String>,
pub fn with_target<S>(self, target: S) -> AssertionBuilder<NoCriteria> where
S: Into<String>,
Sets the target of the span to match.
All span matchers, which includes [with_name
], [with_target
], [with_parent_name
], and
[with_span_field
], are additive, which means a span must match all of them to match the
assertion overall.
sourcepub fn with_parent_name<S>(self, name: S) -> AssertionBuilder<NoCriteria> where
S: Into<String>,
pub fn with_parent_name<S>(self, name: S) -> AssertionBuilder<NoCriteria> where
S: Into<String>,
Sets the name of a parent span to match.
The span must have at least one parent span within its entire lineage that matches the given name.
All span matchers, which includes [with_name
], [with_target
], [with_parent_name
], and
[with_span_field
], are additive, which means a span must match all of them to match the
assertion overall.
sourcepub fn with_span_field<S>(self, field: S) -> AssertionBuilder<NoCriteria> where
S: Into<String>,
pub fn with_span_field<S>(self, field: S) -> AssertionBuilder<NoCriteria> where
S: Into<String>,
Adds a field which the span must contain to match.
The field is matched by name.
All span matchers, which includes [with_name
], [with_target
], and [with_span_field
],
are additive, which means a span must match all of them to match the assertion overall.
sourcepub fn was_created(self) -> AssertionBuilder<Constrained>
pub fn was_created(self) -> AssertionBuilder<Constrained>
Asserts that a matching span was created at least once.
sourcepub fn was_entered(self) -> AssertionBuilder<Constrained>
pub fn was_entered(self) -> AssertionBuilder<Constrained>
Asserts that a matching span was entered at least once.
sourcepub fn was_exited(self) -> AssertionBuilder<Constrained>
pub fn was_exited(self) -> AssertionBuilder<Constrained>
Asserts that a matching span was exited at least once.
sourcepub fn was_closed(self) -> AssertionBuilder<Constrained>
pub fn was_closed(self) -> AssertionBuilder<Constrained>
Asserts that a matching span was closed at least once.
sourcepub fn was_not_created(self) -> AssertionBuilder<Constrained>
pub fn was_not_created(self) -> AssertionBuilder<Constrained>
Asserts that a matching span was not created.
sourcepub fn was_not_entered(self) -> AssertionBuilder<Constrained>
pub fn was_not_entered(self) -> AssertionBuilder<Constrained>
Asserts that a matching span was not entered.
sourcepub fn was_not_exited(self) -> AssertionBuilder<Constrained>
pub fn was_not_exited(self) -> AssertionBuilder<Constrained>
Asserts that a matching span was not exited.
sourcepub fn was_not_closed(self) -> AssertionBuilder<Constrained>
pub fn was_not_closed(self) -> AssertionBuilder<Constrained>
Asserts that a matching span was not closed.
sourcepub fn was_created_exactly(self, n: usize) -> AssertionBuilder<Constrained>
pub fn was_created_exactly(self, n: usize) -> AssertionBuilder<Constrained>
Asserts that a matching span was created exactly n
times.
sourcepub fn was_entered_exactly(self, n: usize) -> AssertionBuilder<Constrained>
pub fn was_entered_exactly(self, n: usize) -> AssertionBuilder<Constrained>
Asserts that a matching span was entered exactly n
times.
sourcepub fn was_exited_exactly(self, n: usize) -> AssertionBuilder<Constrained>
pub fn was_exited_exactly(self, n: usize) -> AssertionBuilder<Constrained>
Asserts that a matching span was exited exactly n
times.
sourcepub fn was_closed_exactly(self, n: usize) -> AssertionBuilder<Constrained>
pub fn was_closed_exactly(self, n: usize) -> AssertionBuilder<Constrained>
Asserts that a matching span was closed exactly n
times.
sourcepub fn was_created_at_least(self, n: usize) -> AssertionBuilder<Constrained>
pub fn was_created_at_least(self, n: usize) -> AssertionBuilder<Constrained>
Asserts that a matching span was created at least n
times.
sourcepub fn was_entered_at_least(self, n: usize) -> AssertionBuilder<Constrained>
pub fn was_entered_at_least(self, n: usize) -> AssertionBuilder<Constrained>
Asserts that a matching span was entered at least n
times.
sourcepub fn was_exited_at_least(self, n: usize) -> AssertionBuilder<Constrained>
pub fn was_exited_at_least(self, n: usize) -> AssertionBuilder<Constrained>
Asserts that a matching span was exited at least n
times.
sourcepub fn was_closed_at_least(self, n: usize) -> AssertionBuilder<Constrained>
pub fn was_closed_at_least(self, n: usize) -> AssertionBuilder<Constrained>
Asserts that a matching span was closed at least n
times.
sourceimpl AssertionBuilder<Constrained>
impl AssertionBuilder<Constrained>
sourcepub fn was_created(self) -> Self
pub fn was_created(self) -> Self
Asserts that a matching span was created at least once.
sourcepub fn was_entered(self) -> Self
pub fn was_entered(self) -> Self
Asserts that a matching span was entered at least once.
sourcepub fn was_exited(self) -> Self
pub fn was_exited(self) -> Self
Asserts that a matching span was exited at least once.
sourcepub fn was_closed(self) -> Self
pub fn was_closed(self) -> Self
Asserts that a matching span was closed at least once.
sourcepub fn was_not_created(self) -> Self
pub fn was_not_created(self) -> Self
Asserts that a matching span was not created.
sourcepub fn was_not_entered(self) -> Self
pub fn was_not_entered(self) -> Self
Asserts that a matching span was not entered.
sourcepub fn was_not_exited(self) -> Self
pub fn was_not_exited(self) -> Self
Asserts that a matching span was not exited.
sourcepub fn was_not_closed(self) -> Self
pub fn was_not_closed(self) -> Self
Asserts that a matching span was not closed.
sourcepub fn was_created_exactly(self, n: usize) -> Self
pub fn was_created_exactly(self, n: usize) -> Self
Asserts that a matching span was created exactly n
times.
sourcepub fn was_entered_exactly(self, n: usize) -> Self
pub fn was_entered_exactly(self, n: usize) -> Self
Asserts that a matching span was entered exactly n
times.
sourcepub fn was_exited_exactly(self, n: usize) -> Self
pub fn was_exited_exactly(self, n: usize) -> Self
Asserts that a matching span was exited exactly n
times.
sourcepub fn was_closed_exactly(self, n: usize) -> Self
pub fn was_closed_exactly(self, n: usize) -> Self
Asserts that a matching span was closed exactly n
times.
sourcepub fn was_created_at_least(self, n: usize) -> Self
pub fn was_created_at_least(self, n: usize) -> Self
Asserts that a matching span was created at least n
times.
sourcepub fn was_entered_at_least(self, n: usize) -> Self
pub fn was_entered_at_least(self, n: usize) -> Self
Asserts that a matching span was entered at least n
times.
sourcepub fn was_exited_at_least(self, n: usize) -> Self
pub fn was_exited_at_least(self, n: usize) -> Self
Asserts that a matching span was exited at least n
times.
sourcepub fn was_closed_at_least(self, n: usize) -> Self
pub fn was_closed_at_least(self, n: usize) -> Self
Asserts that a matching span was closed at least n
times.
Auto Trait Implementations
impl<S> RefUnwindSafe for AssertionBuilder<S>
impl<S> Send for AssertionBuilder<S>
impl<S> Sync for AssertionBuilder<S>
impl<S> Unpin for AssertionBuilder<S>
impl<S> UnwindSafe for AssertionBuilder<S>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more