Enum konsumer_offsets::KonsumerOffsetsData

source ·
pub enum KonsumerOffsetsData {
    OffsetCommit(OffsetCommit),
    GroupMetadata(GroupMetadata),
}
Expand description

Possible types of data stored in __consumer_offsets topic.

This enum is a rust-idiomatic way to handle the fact that the messages read from __consumer_offsets can be of different type. Ideally Kafka could have used 2 different topics, but it doesn’t so… here we are.

Variants§

§

OffsetCommit(OffsetCommit)

Variant that wraps an OffsetCommit struct instance.

§

GroupMetadata(GroupMetadata)

Variant that wraps a GroupMetadata struct instance.

Implementations§

source§

impl KonsumerOffsetsData

source

pub fn try_from_bytes( key: Option<&[u8]>, payload: Option<&[u8]> ) -> Result<KonsumerOffsetsData, KonsumerOffsetsError>

Parses the content of a messages (a.k.a. records) from the __consumer_offsets.

__consumer_offsets it’s a key internal Kafka topic, used by Kafka Consumers to keep track of the offset consumed so far, and also to coordinate their subscriptions and partition assignments.

This method returns a KonsumerOffsetsData: an enum where each variant represents one of the possible messages that this topic carries. Refer to the documentation of each variant for details.

NOTE: As Kafka messages have key and payload both optional, the signature reflects that. But messages of __consumer_offsets have at least a key set: if absent, the method will return an error.

§Arguments
  • key - An Option of &[u8]: when set, it means the source Kafka message has a key. If key is None, this function will return an error: it’s likely that the message it’s not actually from the __consumer_offsets topic.
  • payload - An Option of &[u8]: when set, it means the source Kafka message has a payload. If payload is None, the source Kafka message is a tombstone.
source

pub fn try_from_bytes_vec( key: Option<Vec<u8>>, payload: Option<Vec<u8>> ) -> Result<KonsumerOffsetsData, KonsumerOffsetsError>

Same as Self::try_from_bytes, but handling input as Option<Vec<u8>>.

Trait Implementations§

source§

impl Clone for KonsumerOffsetsData

source§

fn clone(&self) -> KonsumerOffsetsData

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for KonsumerOffsetsData

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for KonsumerOffsetsData

source§

fn eq(&self, other: &KonsumerOffsetsData) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for KonsumerOffsetsData

source§

impl StructuralPartialEq for KonsumerOffsetsData

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.