pub struct Record { /* private fields */ }Expand description
An unordered collection of named fields, each associated with the values.
Implementations§
Source§impl Record
impl Record
Sourcepub fn new<S: Into<Arc<str>>>(
ty: RecordType,
values: impl IntoIterator<Item = (S, Value)>,
) -> Result<Self>
pub fn new<S: Into<Arc<str>>>( ty: RecordType, values: impl IntoIterator<Item = (S, Value)>, ) -> Result<Self>
Creates a new record out of the given fields. Each field must match with
the type given in the RecordType.
Sourcepub fn from_fields<S: Into<Arc<str>>>(
name: Option<TypeIdentifier>,
values: impl IntoIterator<Item = (S, Value)>,
) -> Result<Self>
pub fn from_fields<S: Into<Arc<str>>>( name: Option<TypeIdentifier>, values: impl IntoIterator<Item = (S, Value)>, ) -> Result<Self>
Constructs a record from the provided fields, dynamically determining the type.
Sourcepub fn field(&self, field: impl AsRef<str>) -> Option<Value>
pub fn field(&self, field: impl AsRef<str>) -> Option<Value>
Gets the field with the provided name, if any.
Sourcepub fn fields(&self) -> impl ExactSizeIterator<Item = (&str, Value)>
pub fn fields(&self) -> impl ExactSizeIterator<Item = (&str, Value)>
Gets an iterator over the fields of this record.
Sourcepub fn ty(&self) -> RecordType
pub fn ty(&self) -> RecordType
Gets the type of this value.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Record
impl !RefUnwindSafe for Record
impl Send for Record
impl Sync for Record
impl Unpin for Record
impl !UnwindSafe for Record
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