pub struct Record(/* private fields */);
Expand description
A container for storing key-value pairs of various data types.
This structure provides a flexible way to store and retrieve different types of data using string keys. It supports merging records and provides type-safe access to stored values.
Implementations§
Source§impl Record
impl Record
Sourcepub fn from_scalar(name: impl Into<String>, value: f32) -> Self
pub fn from_scalar(name: impl Into<String>, value: f32) -> Self
Sourcepub fn from_slice<K: Into<String> + Clone>(s: &[(K, RecordValue)]) -> Self
pub fn from_slice<K: Into<String> + Clone>(s: &[(K, RecordValue)]) -> Self
Sourcepub fn keys(&self) -> Keys<'_, String, RecordValue>
pub fn keys(&self) -> Keys<'_, String, RecordValue>
Sourcepub fn insert(&mut self, k: impl Into<String>, v: RecordValue)
pub fn insert(&mut self, k: impl Into<String>, v: RecordValue)
Sourcepub fn iter(&self) -> Iter<'_, String, RecordValue>
pub fn iter(&self) -> Iter<'_, String, RecordValue>
Returns an iterator over the key-value pairs in the record.
§Returns
An iterator over the record’s key-value pairs
Sourcepub fn into_iter_in_record(self) -> IntoIter<String, RecordValue>
pub fn into_iter_in_record(self) -> IntoIter<String, RecordValue>
Returns an iterator that consumes the record.
§Returns
An iterator that takes ownership of the record
Sourcepub fn get(&self, k: &str) -> Option<&RecordValue>
pub fn get(&self, k: &str) -> Option<&RecordValue>
Sourcepub fn merge_inplace(&mut self, record: Record)
pub fn merge_inplace(&mut self, record: Record)
Merges another record into this one in place.
If both records contain the same key, the value from the second record will overwrite the value from this record.
§Arguments
record
- The record to merge with
Sourcepub fn get_scalar_without_key(&self) -> Option<f32>
pub fn get_scalar_without_key(&self) -> Option<f32>
Gets a scalar value from the record without specifying a key.
This method is useful when the record contains only one scalar value.
§Returns
The scalar value if it exists and is the only value in the record