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:
Kevin Leimkuhler
2019-02-20 13:26:20 -08:00
committed by Eliza Weisman
parent cec9efeb7a
commit 75ab7c9e9b
+6 -1
View File
@@ -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
}
}