pub trait AvroRecordExt {
Show 19 methods // Required methods fn get_bool(&self, key: &str) -> Option<bool>; fn get_i32(&self, key: &str) -> Option<i32>; fn get_i64(&self, key: &str) -> Option<i64>; fn get_u16(&self, key: &str) -> Option<u16>; fn get_u32(&self, key: &str) -> Option<u32>; fn get_u64(&self, key: &str) -> Option<u64>; fn get_usize(&self, key: &str) -> Option<usize>; fn get_f32(&self, key: &str) -> Option<f32>; fn get_f64(&self, key: &str) -> Option<f64>; fn get_bytes(&self, key: &str) -> Option<&[u8]>; fn get_str(&self, key: &str) -> Option<&str>; fn contains_key(&self, key: &str) -> bool; fn find(&self, key: &str) -> Option<&AvroValue>; fn position(&self, key: &str) -> Option<usize>; fn upsert( &mut self, key: impl Into<String>, value: impl Into<AvroValue> ) -> Option<AvroValue>; fn flush_to_writer<W: Write>( self, schema: &Schema, writer: W ) -> Result<usize, Error>; fn into_avro_map(self) -> HashMap<String, AvroValue>; fn try_into_map(self) -> Result<Map, Error>; fn from_entry(key: impl Into<String>, value: impl Into<AvroValue>) -> Self;
}
Expand description

Extension trait for Record.

Required Methods§

source

fn get_bool(&self, key: &str) -> Option<bool>

Extracts the boolean value corresponding to the key.

source

fn get_i32(&self, key: &str) -> Option<i32>

Extracts the integer value corresponding to the key.

source

fn get_i64(&self, key: &str) -> Option<i64>

Extracts the Long integer value corresponding to the key.

source

fn get_u16(&self, key: &str) -> Option<u16>

Extracts the integer value corresponding to the key and represents it as u16 if possible.

source

fn get_u32(&self, key: &str) -> Option<u32>

Extracts the integer value corresponding to the key and represents it as u32 if possible.

source

fn get_u64(&self, key: &str) -> Option<u64>

Extracts the integer value corresponding to the key and represents it as u64 if possible.

source

fn get_usize(&self, key: &str) -> Option<usize>

Extracts the integer value corresponding to the key and represents it as usize if possible.

source

fn get_f32(&self, key: &str) -> Option<f32>

Extracts the float value corresponding to the key.

source

fn get_f64(&self, key: &str) -> Option<f64>

Extracts the float value corresponding to the key.

source

fn get_bytes(&self, key: &str) -> Option<&[u8]>

Extracts the bytes corresponding to the key.

source

fn get_str(&self, key: &str) -> Option<&str>

Extracts the string corresponding to the key.

source

fn contains_key(&self, key: &str) -> bool

Returns true if the record contains a value for the key.

source

fn find(&self, key: &str) -> Option<&AvroValue>

Searches for the key and returns its value.

source

fn position(&self, key: &str) -> Option<usize>

Searches for the key and returns its index.

source

fn upsert( &mut self, key: impl Into<String>, value: impl Into<AvroValue> ) -> Option<AvroValue>

Inserts or updates a pair into the record. If the record did have this key, the value is updated and the old value is returned, otherwise None is returned.

source

fn flush_to_writer<W: Write>( self, schema: &Schema, writer: W ) -> Result<usize, Error>

Flushes the content appended to a writer with the given schema. Returns the number of bytes written.

source

fn into_avro_map(self) -> HashMap<String, AvroValue>

Converts self to an Avro map.

source

fn try_into_map(self) -> Result<Map, Error>

Consumes self and attempts to construct a json object.

source

fn from_entry(key: impl Into<String>, value: impl Into<AvroValue>) -> Self

Creates a new instance with the entry.

Object Safety§

This trait is not object safe.

Implementors§