Struct rdkafka::message::BorrowedMessage[][src]

pub struct BorrowedMessage<'a> { /* fields omitted */ }

A zero-copy Kafka message.

Provides a read-only access to headers owned by a Kafka consumer or producer or by an OwnedMessage struct.

Consumers

BorrowedMessages coming from consumers are removed from the consumer buffer once they are dropped. Holding references to too many messages will cause the memory of the consumer to fill up and the consumer to block until some of the BorrowedMessages are dropped.

Conversion to owned

To transform a BorrowedMessage into a OwnedMessage, use the detach method.

Implementations

impl<'a> BorrowedMessage<'a>[src]

pub fn ptr(&self) -> *mut RDKafkaMessage[src]

Returns a pointer to the RDKafkaMessage.

pub fn topic_ptr(&self) -> *mut RDKafkaTopic[src]

Returns a pointer to the message’s RDKafkaTopic

pub fn key_len(&self) -> usize[src]

Returns the length of the key field of the message.

pub fn payload_len(&self) -> usize[src]

Returns the length of the payload field of the message.

pub fn detach(&self) -> OwnedMessage[src]

Clones the content of the BorrowedMessage and returns an OwnedMessage that can outlive the consumer.

This operation requires memory allocation and can be expensive.

Trait Implementations

impl<'a> Debug for BorrowedMessage<'a>[src]

impl<'a> Message for BorrowedMessage<'a>[src]

type Headers = BorrowedHeaders

The type of headers that this message contains.

impl<'a> Send for BorrowedMessage<'a>[src]

impl<'a> Sync for BorrowedMessage<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for BorrowedMessage<'a>

impl<'a> Unpin for BorrowedMessage<'a>

impl<'a> UnwindSafe for BorrowedMessage<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.