Struct Batch

Source
pub struct Batch<R>
where R: BatchRecords,
{ pub base_offset: Offset, pub batch_len: i32, pub header: BatchHeader, pub records: R, }

Fields§

§base_offset: Offset§batch_len: i32§header: BatchHeader§records: R

Implementations§

Source§

impl<R> Batch<R>
where R: BatchRecords,

Source

pub fn get_mut_header(&mut self) -> &mut BatchHeader

Source

pub fn get_header(&self) -> &BatchHeader

Source

pub fn get_base_offset(&self) -> Offset

Source

pub fn set_base_offset(&mut self, offset: Offset)

Source

pub fn base_offset(self, offset: Offset) -> Self

Source

pub fn set_offset_delta(&mut self, delta: i32)

Source

pub fn get_last_offset(&self) -> Offset

Source

pub fn get_last_offset_delta(&self) -> Size

get last offset delta

Source

pub fn decode_from_file_buf<T>( &mut self, src: &mut T, version: Version, ) -> Result<(), Error>
where T: Buf,

decode from buf stored in the file read all excluding records

Source§

impl Batch<DefaultBatchRecords>

Source

pub fn add_record(&mut self, record: DefaultRecord)

add new record, this will update the offset to correct

Trait Implementations§

Source§

impl<R> Debug for Batch<R>
where R: BatchRecords + Debug,

Source§

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

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

impl<R> Decoder for Batch<R>
where R: BatchRecords,

Source§

fn decode<T>(&mut self, src: &mut T, version: Version) -> Result<(), Error>
where T: Buf,

Source§

fn decode_from<T>(src: &mut T, version: i16) -> Result<Self, Error>
where T: Buf, Self: Default,

decode Kafka compliant protocol values from buf
Source§

impl<R> Default for Batch<R>
where R: BatchRecords + Default,

Source§

fn default() -> Batch<R>

Returns the “default value” for a type. Read more
Source§

impl<R> Encoder for Batch<R>
where R: BatchRecords,

Source§

fn write_size(&self, version: Version) -> usize

size of this object in bytes
Source§

fn encode<T>(&self, dest: &mut T, version: Version) -> Result<(), Error>
where T: BufMut,

encoding contents for buffer
Source§

fn as_bytes(&self, version: i16) -> Result<Bytes, Error>

Auto Trait Implementations§

§

impl<R> Freeze for Batch<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for Batch<R>
where R: RefUnwindSafe,

§

impl<R> Send for Batch<R>
where R: Send,

§

impl<R> Sync for Batch<R>
where R: Sync,

§

impl<R> Unpin for Batch<R>
where R: Unpin,

§

impl<R> UnwindSafe for Batch<R>
where R: UnwindSafe,

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

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more