MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / read_next

Method read_next

src/avro/src/reader.rs:234–249  ·  view source on GitHub ↗

Read the next Avro value from the file, if one exists.

(&mut self)

Source from the content-addressed store, hash-verified

232 #[inline]
233 /// Read the next Avro value from the file, if one exists.
234 pub fn read_next(&mut self) -> Result<Option<Value>, AvroError> {
235 if self.is_empty() {
236 self.read_block_next()?;
237 if self.is_empty() {
238 return Ok(None);
239 }
240 }
241
242 let mut block_bytes = &self.buf[self.buf_idx..];
243 let b_original = block_bytes.len();
244 let schema = self.schema();
245 let item = from_avro_datum(schema, &mut block_bytes)?;
246 self.buf_idx += b_original - block_bytes.len();
247 self.messages_remaining -= 1;
248 Ok(Some(item))
249 }
250
251 fn is_empty(&self) -> bool {
252 self.messages_remaining == 0

Callers 1

nextMethod · 0.80

Calls 5

from_avro_datumFunction · 0.85
read_block_nextMethod · 0.80
is_emptyMethod · 0.45
lenMethod · 0.45
schemaMethod · 0.45

Tested by

no test coverage detected