pub trait EncodeLabelSet {
// Required method
fn encode(&self, encoder: &mut dyn LabelSetEncoder) -> Result<()>;
// Provided method
fn is_empty(&self) -> bool { ... }
}Expand description
Trait for types that can be encoded as a set of labels.
This trait is implemented by types that represent collections of labels, such as vectors or maps of label pairs. It provides the ability to encode multiple labels as a complete set.
§Example
// labels implements `EncodeLabelSet` and can be encoded as a label set
let labels = vec![("method", "GET"), ("status", "200")];Required Methods§
Sourcefn encode(&self, encoder: &mut dyn LabelSetEncoder) -> Result<()>
fn encode(&self, encoder: &mut dyn LabelSetEncoder) -> Result<()>
Encodes this set of labels using the provided LabelSetEncoder.
This method should encode all labels in the set using the provided encoder, typically by getting individual label encoder for each label in the set.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".