Skip to main content

ConsumerRecords

Struct ConsumerRecords 

Source
pub struct ConsumerRecords {
    pub topic: String,
    pub partition: i32,
    pub batches: Vec<LeanBatch>,
    pub fallback: Vec<Record>,
}
Expand description

What one partition yielded.

Fields§

§topic: String§partition: i32§batches: Vec<LeanBatch>

The batches as barnabas_core::records read them.

§fallback: Vec<Record>

Records from a batch the lean reader handed back — only a pre-magic-2 batch does — decoded the ordinary way. Kept separate rather than converted, because building a LeanBatch from decoded records would mean re-serialising them.

Implementations§

Source§

impl ConsumerRecords

Source

pub fn iter(&self) -> impl Iterator<Item = RecordRef<'_>>

Every record, whichever path decoded it.

This is what callers should use. Records live in batches because that is how the format stores them and how the filtering works, but a caller almost never cares which batch a record came from — and having to nest two loops, plus handle the fallback, would be a bad trade for the speed it buys.

Source

pub fn len(&self) -> usize

How many records this partition yielded.

Source

pub fn is_empty(&self) -> bool

Trait Implementations§

Source§

impl Debug for ConsumerRecords

Source§

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

Formats the value using the given formatter. Read more

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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.