mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-24 00:00:11 +02:00
trace: Allow Span IDs to be converted back to u64s (#910)
## Motivation As described in #905, subscribers have no way to get the numeric value of a span ID back _out_ of a `Span`. ## Solution Add a `Span::into_u64` method that returns the inner `u64` span ID Closes #905 Signed-off-by: kleimkuhler <[email protected]>
This commit is contained in:
committed by
Eliza Weisman
parent
cec9efeb7a
commit
75ab7c9e9b
@@ -2,7 +2,7 @@
|
||||
|
||||
/// Identifies a span within the context of a process.
|
||||
///
|
||||
/// Span IDs are used primarily to determine of two handles refer to the same
|
||||
/// Span IDs are used primarily to determine if two handles refer to the same
|
||||
/// span, without requiring the comparison of the span's fields.
|
||||
///
|
||||
/// They are generated by [`Subscriber`](::Subscriber)s for each span as it is
|
||||
@@ -19,4 +19,9 @@ impl Span {
|
||||
pub fn from_u64(u: u64) -> Self {
|
||||
Span(u)
|
||||
}
|
||||
|
||||
/// Returns the span's ID as a `u64`.
|
||||
pub fn into_u64(&self) -> u64 {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user