Struct rdkafka::message::OwnedMessage
source · pub struct OwnedMessage { /* private fields */ }
Expand description
A Kafka message that owns its backing data.
An OwnedMessage
can be created from a BorrowedMessage
using the
BorrowedMessage::detach
method. OwnedMessage
s don’t hold any reference
to the consumer and don’t use any memory inside the consumer buffer.
Implementations§
source§impl OwnedMessage
impl OwnedMessage
sourcepub fn new(
payload: Option<Vec<u8>>,
key: Option<Vec<u8>>,
topic: String,
timestamp: Timestamp,
partition: i32,
offset: i64,
headers: Option<OwnedHeaders>,
) -> OwnedMessage
pub fn new( payload: Option<Vec<u8>>, key: Option<Vec<u8>>, topic: String, timestamp: Timestamp, partition: i32, offset: i64, headers: Option<OwnedHeaders>, ) -> OwnedMessage
Creates a new message with the specified content.
This function is mainly useful in tests of rust-rdkafka
itself.
sourcepub fn detach_headers(&mut self) -> Option<OwnedHeaders>
pub fn detach_headers(&mut self) -> Option<OwnedHeaders>
Detaches the OwnedHeaders
from this OwnedMessage
.
Trait Implementations§
source§impl Clone for OwnedMessage
impl Clone for OwnedMessage
source§fn clone(&self) -> OwnedMessage
fn clone(&self) -> OwnedMessage
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 OwnedMessage
impl Debug for OwnedMessage
source§impl Message for OwnedMessage
impl Message for OwnedMessage
§type Headers = OwnedHeaders
type Headers = OwnedHeaders
The type of headers that this message contains.
source§fn payload(&self) -> Option<&[u8]>
fn payload(&self) -> Option<&[u8]>
Returns the payload of the message, or
None
if there is no payload.source§unsafe fn payload_mut(&mut self) -> Option<&mut [u8]>
unsafe fn payload_mut(&mut self) -> Option<&mut [u8]>
Returns a mutable reference to the payload of the message, or
None
if
there is no payload. Read moresource§fn headers(&self) -> Option<&OwnedHeaders>
fn headers(&self) -> Option<&OwnedHeaders>
Returns the headers of the message, or
None
if there are no headers.Auto Trait Implementations§
impl Freeze for OwnedMessage
impl RefUnwindSafe for OwnedMessage
impl Send for OwnedMessage
impl Sync for OwnedMessage
impl Unpin for OwnedMessage
impl UnwindSafe for OwnedMessage
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
)