Skip to main content

AttributesFactory

Trait AttributesFactory 

pub trait AttributesFactory:
    Send
    + Sync
    + 'static {
    // Required method
    fn attributes(&self, size_hint: usize, ext: &Extensions) -> Vec<KeyValue>;
}
Available on crate feature opentelemetry only.
Expand description

Trait that can be used to implement your own attributes creator. It is used by layers as a starting point for attributes, and they will add their own attributes on top.

Required Methods§

fn attributes(&self, size_hint: usize, ext: &Extensions) -> Vec<KeyValue>

Create an attributes Vec.

The size_hint indicates how many attributes the callee may wish to add on top

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

§

impl AttributesFactory for ()

§

fn attributes(&self, size_hint: usize, _ext: &Extensions) -> Vec<KeyValue>

Implementors§

§

impl AttributesFactory for Vec<KeyValue>

§

impl<F> AttributesFactory for F
where F: Fn(usize, &Extensions) -> Vec<KeyValue> + Send + Sync + 'static,