pub struct BorrowedMessage<'a> { /* private fields */ }
Expand description

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

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

Formats the value using the given formatter. Read more

The type of headers that this message contains.

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 a mutable reference to the payload of the message, or None if there is no payload. Read more

Returns the source topic of the message.

Returns the partition number where the message is stored.

Returns the offset of the message within the partition.

Returns the message timestamp.

Returns the headers of the message, or None if there are no headers.

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.