pub struct Batch<R = MemoryRecords> {
pub base_offset: Offset,
pub batch_len: i32,
pub header: BatchHeader,
/* private fields */
}Fields§
§base_offset: Offset§batch_len: i32§header: BatchHeaderImplementations§
Source§impl<R> Batch<R>
impl<R> Batch<R>
pub fn get_mut_header(&mut self) -> &mut BatchHeader
pub fn get_header(&self) -> &BatchHeader
pub fn own_records(self) -> R
pub fn records(&self) -> &R
pub fn mut_records(&mut self) -> &mut R
pub fn get_base_offset(&self) -> Offset
pub fn set_base_offset(&mut self, offset: Offset)
pub fn base_offset(self, offset: Offset) -> Self
pub fn add_to_offset_delta(&mut self, delta: i32)
pub fn set_offset_delta(&mut self, delta: i32)
pub fn get_last_offset(&self) -> Offset
pub fn records_len(&self) -> usize
Sourcepub fn get_last_offset_delta(&self) -> Size
👎Deprecated since 0.9.2: use last_offset_delta instead
pub fn get_last_offset_delta(&self) -> Size
get last offset delta
pub fn last_offset_delta(&self) -> i32
pub fn get_compression(&self) -> Result<Compression, CompressionError>
Source§impl<R> Batch<R>where
R: Encoder,
impl<R> Batch<R>where
R: Encoder,
Sourcepub fn validate_decoding(&self) -> bool
pub fn validate_decoding(&self) -> bool
check if batch is valid after decoded
Source§impl<R: BatchRecords> Batch<R>
impl<R: BatchRecords> Batch<R>
Sourcepub fn computed_last_offset(&self) -> Offset
pub fn computed_last_offset(&self) -> Offset
computed last offset which is base offset + number of records
Source§impl Batch
impl Batch
Sourcepub fn add_record(&mut self, record: Record)
pub fn add_record(&mut self, record: Record)
add new record, this will update the offset to correct
pub fn add_records(&mut self, records: &mut Vec<Record>)
pub fn update_offset_deltas(&mut self)
pub fn into_consumer_records_iter( self, partition: PartitionId, ) -> impl Iterator<Item = ConsumerRecord>
Source§impl Batch<RawRecords>
impl Batch<RawRecords>
pub fn memory_records(&self) -> Result<MemoryRecords, CompressionError>
Trait Implementations§
Source§impl<R> Decoder for Batch<R>where
R: BatchRecords,
impl<R> Decoder for Batch<R>where
R: BatchRecords,
Source§impl<R> Encoder for Batch<R>where
R: BatchRecords,
impl<R> Encoder for Batch<R>where
R: BatchRecords,
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more