pub trait Headers {
    fn count(&self) -> usize;
    fn try_get(&self, idx: usize) -> Option<Header<'_, &[u8]>>;

    fn get(&self, idx: usize) -> Header<'_, &[u8]> { ... }
    fn get_as<V>(&self, idx: usize) -> Result<Header<'_, &V>, V::Error>
    where
        V: FromBytes + ?Sized
, { ... } fn try_get_as<V>(
        &self,
        idx: usize
    ) -> Option<Result<Header<'_, &V>, V::Error>>
    where
        V: FromBytes + ?Sized
, { ... } fn iter(&self) -> HeadersIter<'_, Self>Notable traits for HeadersIter<'a, H>impl<'a, H> Iterator for HeadersIter<'a, H>where
    H: Headers,
type Item = Header<'a, &'a [u8]>;

    where
        Self: Sized
, { ... } }
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.

Like Headers::get, but returns an option if the header is out of bounds rather than panicking.

Provided Methods

Gets the specified header, where the first header corresponds to index 0.

Panics if the index is out of bounds.

Like Headers::get, but the value of the header will be converted to the specified type.

Panics if the index is out of bounds.

Like Headers::get, but returns an option if the header is out of bounds rather than panicking.

Iterates over all headers in order.

Implementors