Struct rdkafka::message::OwnedMessage
[−]
[src]
pub struct OwnedMessage { /* fields omitted */ }
An OwnedMessage
can be created from a BorrowedMessage
using the detach
method.
OwnedMessage
s don't hold any reference to the consumer, and don't use any memory inside the
consumer buffer.
Methods
impl OwnedMessage
[src]
fn new(
payload: Option<Vec<u8>>,
key: Option<Vec<u8>>,
topic: String,
timestamp: Timestamp,
partition: i32,
offset: i64
) -> OwnedMessage
payload: Option<Vec<u8>>,
key: Option<Vec<u8>>,
topic: String,
timestamp: Timestamp,
partition: i32,
offset: i64
) -> OwnedMessage
Create a new message with the specified content. Mainly useful for writing tests.
Trait Implementations
impl Message for OwnedMessage
[src]
fn key(&self) -> Option<&[u8]>
Returns the key of the message, or None if there is no key.
fn payload(&self) -> Option<&[u8]>
Returns the payload of the message, or None if there is no payload.
fn topic(&self) -> &str
Returns the source topic of the message.
fn partition(&self) -> i32
Returns the partition number where the message is stored.
fn offset(&self) -> i64
Returns the offset of the message.
fn timestamp(&self) -> Timestamp
Returns the message timestamp for a consumed message if available.
fn payload_view<P: ?Sized + FromBytes>(&self) -> Option<Result<&P, P::Error>>
Converts the raw bytes of the payload to a reference of the specified type, that points to the same data inside the message and without performing any memory allocation Read more
fn key_view<K: ?Sized + FromBytes>(&self) -> Option<Result<&K, K::Error>>
Converts the raw bytes of the key to a reference of the specified type, that points to the same data inside the message and without performing any memory allocation Read more