pub struct BorrowedHeaders;
Expand description
A zero-copy collection of Kafka message headers.
Provides a read-only access to headers owned by a Kafka consumer or producer
or by an OwnedHeaders
struct.
Implementations§
Source§impl BorrowedHeaders
impl BorrowedHeaders
Sourcepub fn detach(&self) -> OwnedHeaders
pub fn detach(&self) -> OwnedHeaders
Clones the content of BorrowedHeaders
and returns an OwnedHeaders
that can outlive the consumer.
This operation requires memory allocation and can be expensive.
Trait Implementations§
Source§impl Headers for BorrowedHeaders
impl Headers for BorrowedHeaders
Source§fn try_get(&self, idx: usize) -> Option<Header<'_, &[u8]>>
fn try_get(&self, idx: usize) -> Option<Header<'_, &[u8]>>
Like
Headers::get
, but returns an option if the header is out of
bounds rather than panicking.Source§fn get(&self, idx: usize) -> Header<'_, &[u8]>
fn get(&self, idx: usize) -> Header<'_, &[u8]>
Gets the specified header, where the first header corresponds to
index 0. Read more
Source§fn get_as<V>(&self, idx: usize) -> Result<Header<'_, &V>, V::Error>
fn get_as<V>(&self, idx: usize) -> Result<Header<'_, &V>, V::Error>
Like
Headers::get
, but the value of the header will be converted
to the specified type. Read moreSource§fn try_get_as<V>(&self, idx: usize) -> Option<Result<Header<'_, &V>, V::Error>>
fn try_get_as<V>(&self, idx: usize) -> Option<Result<Header<'_, &V>, V::Error>>
Like
Headers::get
, but returns an option if the header is out of
bounds rather than panicking.Auto Trait Implementations§
impl Freeze for BorrowedHeaders
impl RefUnwindSafe for BorrowedHeaders
impl Send for BorrowedHeaders
impl Sync for BorrowedHeaders
impl Unpin for BorrowedHeaders
impl UnwindSafe for BorrowedHeaders
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more