Struct rdkafka::message::BorrowedMessage
source · [−]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
BorrowedMessage
s 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 BorrowedMessage
s 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 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
type Headers = BorrowedHeaders
type Headers = BorrowedHeaders
The type of headers that this message contains.
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 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