logo
pub trait Encoder: Debug {
    fn encode(
        &self,
        attributes: &mut dyn Iterator<Item = (&Key, &Value)>
    ) -> String; fn id(&self) -> EncoderId; }
Available on crate feature metrics only.
Expand description

Encoder is a mechanism for serializing an attribute set into a specific string representation that supports caching, to avoid repeated serialization. An example could be an exporter encoding the attribute set into a wire representation.

Required Methods

Encode returns the serialized encoding of the attribute set using its Iterator. This result may be cached.

A value that is unique for each class of attribute encoder. Attribute encoders allocate these using new_encoder_id.

Implementors