pub struct Record<'a> {
pub fields: Vec<(String, Value)>,
/* private fields */
}
Expand description
Utility interface to build Value::Record
objects.
Fields§
§fields: Vec<(String, Value)>
List of fields contained in the record.
Ordered according to the fields in the schema given to create this
Record
object. Any unset field defaults to Value::Null
.
Implementations§
source§impl<'a> Record<'a>
impl<'a> Record<'a>
sourcepub fn new(schema: SchemaNode<'a>) -> Option<Record<'a>>
pub fn new(schema: SchemaNode<'a>) -> Option<Record<'a>>
Create a Record
given a SchemaNode
.
If the SchemaNode
is not a SchemaPiece::Record
variant, None
will be returned.
sourcepub fn put<V>(&mut self, field: &str, value: V)where
V: ToAvro,
pub fn put<V>(&mut self, field: &str, value: V)where V: ToAvro,
Put a compatible value (implementing the ToAvro
trait) in the
Record
for a given field
name.
NOTE Only ensure that the field name is present in the SchemaNode
given when creating
this Record
. Does not perform any schema validation.
sourcepub fn field_by_name(&self, name: &str) -> Option<&'a RecordField>
pub fn field_by_name(&self, name: &str) -> Option<&'a RecordField>
Get the field description corresponding to the given name.
Trait Implementations§
Auto Trait Implementations§
impl<'a> RefUnwindSafe for Record<'a>
impl<'a> Send for Record<'a>
impl<'a> Sync for Record<'a>
impl<'a> Unpin for Record<'a>
impl<'a> UnwindSafe for Record<'a>
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