Struct opentracingrust::ImplContextBox
[−]
[src]
pub struct ImplContextBox<T: Any + Clone + Send + SpanReferenceAware> { /* fields omitted */ }
Utility structure to create ImplContext
s.
Generic structure that creates a wrapper around structures to make them
compatible with ImplContext
trait objects.
The wrapped structure requires the following traits to be implemented:
Any
Clone
Send
SpanReferenceAware
Examples
extern crate opentracingrust; use opentracingrust::ImplContext; use opentracingrust::ImplContextBox; use opentracingrust::SpanReference; use opentracingrust::SpanReferenceAware; #[derive(Clone)] struct Context { // ... snip ... } impl SpanReferenceAware for Context { fn reference_span(&mut self, reference: &SpanReference) { // ... snip ... } } fn main() { let context: Box<ImplContext> = Box::new(ImplContextBox::new(Context{})); // ... snip ... }
Methods
impl<T: Any + Clone + Send + SpanReferenceAware> ImplContextBox<T>
[src]
fn new(inner: T) -> ImplContextBox<T>
[src]
Wrap a compatible value into a ImplContextBox
.
Trait Implementations
impl<T: Any + Clone + Send + SpanReferenceAware> ImplContext for ImplContextBox<T>
[src]
fn impl_context(&self) -> &Any
[src]
Allow runtime downcasting with the Any
interface. Read more
fn clone(&self) -> Box<ImplContext>
[src]
Clones an ImplContext
trait object into a new ImplContext
trait object.
fn reference_span(&mut self, reference: &SpanReference)
[src]
Allows the ImplContext
to add references. Read more