Struct opentracingrust::ImplContextBox [] [src]

pub struct ImplContextBox<T: Any + Clone + Send + SpanReferenceAware> { /* fields omitted */ }

Utility structure to create ImplContexts.

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]

[src]

Wrap a compatible value into a ImplContextBox.

Trait Implementations

impl<T: Any + Clone + Send + SpanReferenceAware> ImplContext for ImplContextBox<T>
[src]

[src]

Allow runtime downcasting with the Any interface. Read more

[src]

Clones an ImplContext trait object into a new ImplContext trait object.

[src]

Allows the ImplContext to add references. Read more