pub struct Span { /* private fields */ }Expand description
An open span. Closes when dropped.
Neither Send nor Sync, and that is enforced rather than asked for: the
end is pushed onto the buffer of whichever thread drops the guard, so a guard
that crossed a thread boundary would pair its end with another thread’s begin
and corrupt both tracks’ nesting.
An end always closes the innermost span still open on the track, which for guards held in locals — the shape this is for — is the guard being dropped. Guards kept in a collection and dropped out of order still produce a well-formed trace, but the durations are attributed by nesting rather than by which guard went first.
The Send bound is what refuses the first of those, and it refuses it at
compile time:
ⓘ
let span = crcbl_core::trace::span("frame");
std::thread::spawn(move || drop(span));Trait Implementations§
Auto Trait Implementations§
impl !Send for Span
impl !Sync for Span
impl Freeze for Span
impl RefUnwindSafe for Span
impl Unpin for Span
impl UnsafeUnpin for Span
impl UnwindSafe for Span
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