Struct rdkafka::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>) -> OwnedHeaders
pub fn insert<V>(self, header: Header<'_, &V>) -> OwnedHeaders
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§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::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.impl Send for OwnedHeaders
impl Sync for OwnedHeaders
Auto Trait Implementations§
impl Freeze for OwnedHeaders
impl RefUnwindSafe for OwnedHeaders
impl Unpin for OwnedHeaders
impl UnwindSafe for OwnedHeaders
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)