Struct rdkafka_wrap::message::OwnedHeaders
source · pub struct OwnedHeaders { /* private fields */ }
Expand description
A collection of Kafka message headers that owns its backing data.
Kafka supports associating an array of key-value pairs to every message,
called message headers. The OwnedHeaders
can be used to create the desired
headers and to pass them to the producer. See also BorrowedHeaders
.
Implementations§
source§impl OwnedHeaders
impl OwnedHeaders
sourcepub fn new() -> OwnedHeaders
pub fn new() -> OwnedHeaders
Creates a new OwnedHeaders
struct with initial capacity 5.
sourcepub fn new_with_capacity(initial_capacity: usize) -> OwnedHeaders
pub fn new_with_capacity(initial_capacity: usize) -> OwnedHeaders
Creates a new OwnedHeaders
struct with the desired initial capacity.
The structure is automatically resized as more headers are added.
sourcepub fn insert<V>(self, header: Header<'_, &V>) -> OwnedHeaderswhere
V: ToBytes + ?Sized,
pub fn insert<V>(self, header: Header<'_, &V>) -> OwnedHeaderswhere V: ToBytes + ?Sized,
Inserts a new header.
sourcepub fn as_borrowed(&self) -> &BorrowedHeaders
pub fn as_borrowed(&self) -> &BorrowedHeaders
Generates a read-only BorrowedHeaders
reference.
Trait Implementations§
source§impl Clone for OwnedHeaders
impl Clone for OwnedHeaders
source§fn clone(&self) -> OwnedHeaders
fn clone(&self) -> OwnedHeaders
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for OwnedHeaders
impl Debug for OwnedHeaders
source§impl Default for OwnedHeaders
impl Default for OwnedHeaders
source§fn default() -> OwnedHeaders
fn default() -> OwnedHeaders
Returns the “default value” for a type. Read more
source§impl Headers for OwnedHeaders
impl Headers for OwnedHeaders
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 as FromBytes>::Error>where
V: FromBytes + ?Sized,
fn get_as<V>( &self, idx: usize ) -> Result<Header<'_, &V>, <V as FromBytes>::Error>where V: FromBytes + ?Sized,
Like
Headers::get
, but the value of the header will be converted
to the specified type. Read moreimpl Send for OwnedHeaders
impl Sync for OwnedHeaders
Auto Trait Implementations§
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