pub trait Headers {
    fn count(&self) -> usize;
fn get(&self, idx: usize) -> Option<(&str, &[u8])>; fn get_as<V: FromBytes + ?Sized>(
        &self,
        idx: usize
    ) -> Option<(&str, Result<&V, V::Error>)> { ... } }
Expand description

A generic representation of Kafka message headers.

This trait represents readable message headers. Headers are key-value pairs that can be sent alongside every message. Only read-only methods are provided by this trait, as the underlying storage might not allow modification.

Required methods

Returns the number of contained headers.

Gets the specified header, where the first header corresponds to index 0. If the index is out of bounds, returns None.

Provided methods

Like Headers::get, but the value of the header will be converted to the specified type. If the conversion fails, returns an error.

Implementors