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

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

A native librdkafka message. The content of the message is stored in the receiving buffer of the consumer, to avoid memory allocations. As such, BorrowedMessage cannot outlive the consumer it is received from. BorrowedMessages are removed from the consumer buffer once they are dropped. Holding references to many messages might cause the memory of the consumer to fill up and stop. To transform a BorrowedMessage into a OwnedMessage, use the detach method.

Methods

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

Creates a new BorrowedMessage that wraps the native Kafka message pointer. The lifetime of the message will be bound to the lifetime of the consumer passed as parameter.

Returns a pointer to the RDKafkaMessage.

Returns a pointer to the message's RDKafkaTopic

Returns the length of the key field of the message.

Returns the length of the payload field of the message.

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]

Formats the value using the given formatter.

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

Returns the key of the message, or None if there is no key.

Returns the payload of the message, or None if there is no payload.

Returns the source topic of the message.

Returns the partition number where the message is stored.

Returns the offset of the message.

Returns the message timestamp for a consumed message if available.

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

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

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

A method called when the value goes out of scope. Read more