Struct rdkafka::message::BorrowedHeaders
source · 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