pub trait Encoder: Debug {
    // Required methods
    fn encode(
        &self,
        attributes: &mut dyn Iterator<Item = (&Key, &Value)>
    ) -> String;
    fn id(&self) -> EncoderId;
}
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§

source

fn encode(&self, attributes: &mut dyn Iterator<Item = (&Key, &Value)>) -> String

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

source

fn id(&self) -> EncoderId

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

Implementors§