Struct rdkafka::message::Message
[−]
[src]
pub struct Message { /* fields omitted */ }
A native librdkafka message.
Methods
impl<'a> Message
[src]
fn new(ptr: *mut RDKafkaMessage) -> Message
Creates a new Message that wraps the native Kafka message pointer.
fn ptr(&self) -> *mut RDKafkaMessage
Returns a pointer to the RDKafkaMessage.
fn key_len(&self) -> usize
Returns the length of the key field of the message.
fn payload_len(&self) -> usize
Returns the length of the payload field of the message.
fn key(&'a self) -> Option<&'a [u8]>
Returns the key of the message, or None if there is no key.
fn payload(&'a self) -> Option<&'a [u8]>
Returns the payload of the message, or None if there is no payload.
fn payload_view<P: ?Sized + FromBytes>(&'a self)
-> Option<Result<&'a P, P::Error>>
-> Option<Result<&'a P, P::Error>>
Converts the raw bytes of the payload to a reference of type &P, pointing to the same data inside the message. The returned reference cannot outlive the message.
fn key_view<K: ?Sized + FromBytes>(&'a self) -> Option<Result<&'a K, K::Error>>
Converts the raw bytes of the key to a reference of type &K, pointing to the same data inside the message. The returned reference cannot outlive 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.