Struct rustracing::Tracer
source · [−]pub struct Tracer<S, T> { /* private fields */ }
Expand description
Tracer.
Examples
use rustracing::Tracer;
use rustracing::sampler::AllSampler;
let (span_tx, span_rx) = crossbeam_channel::bounded(10);
let tracer = Tracer::with_sender(AllSampler, span_tx);
{
let _span = tracer.span("foo").start_with_state(());
}
let span = span_rx.try_recv().unwrap();
assert_eq!(span.operation_name(), "foo");
Implementations
sourceimpl<S: Sampler<T>, T> Tracer<S, T>
impl<S: Sampler<T>, T> Tracer<S, T>
sourcepub fn new(sampler: S) -> (Self, SpanReceiver<T>)
pub fn new(sampler: S) -> (Self, SpanReceiver<T>)
This constructor is mainly for backward compatibility, it has the same interface
as in previous versions except the type of SpanReceiver
.
It builds an unbounded channel which may cause memory issues if there is no reader,
prefer with_sender()
alternative with a bounded one.
sourcepub fn with_sender(sampler: S, span_tx: SpanSender<T>) -> Self
pub fn with_sender(sampler: S, span_tx: SpanSender<T>) -> Self
Makes a new Tracer
instance.
Trait Implementations
Auto Trait Implementations
impl<S, T> RefUnwindSafe for Tracer<S, T> where
S: RefUnwindSafe,
impl<S, T> Send for Tracer<S, T> where
S: Send + Sync,
T: Send,
impl<S, T> Sync for Tracer<S, T> where
S: Send + Sync,
T: Send,
impl<S, T> Unpin for Tracer<S, T>
impl<S, T> UnwindSafe for Tracer<S, T> where
S: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more