pub struct Row<'a> { /* private fields */ }
Expand description
A single row in a Realm table. This allows you to either extract Value
s
manually, or use realm_model!
to convert them into
your own structs.
Implementations§
Source§impl<'a> Row<'a>
impl<'a> Row<'a>
Sourcepub fn entries(&self) -> impl Iterator<Item = (&Cow<'a, str>, &Value)>
pub fn entries(&self) -> impl Iterator<Item = (&Cow<'a, str>, &Value)>
Returns an iterator over the column names and values in this row.
Sourcepub fn values(&self) -> impl Iterator<Item = &Value>
pub fn values(&self) -> impl Iterator<Item = &Value>
Returns an iterator over the values in this row.
Sourcepub fn get(&self, column_name: &str) -> Option<&Value>
pub fn get(&self, column_name: &str) -> Option<&Value>
Get the value of a column by its name. Returns None
if the column does
not exist.
Sourcepub fn take(&mut self, column_name: &str) -> Option<Value>
pub fn take(&mut self, column_name: &str) -> Option<Value>
Take the value of a column by its name. Returns None
if the column
does not exist. This method consumes the value, removing it from the
row. It is used by realm_model
to transfer the
backlinks to your custom struct.
Sourcepub fn backlinks(&self) -> impl Iterator<Item = &Backlink>
pub fn backlinks(&self) -> impl Iterator<Item = &Backlink>
Returns an iterator over the Backlink
s in this row.
Sourcepub fn take_backlinks(&mut self) -> Vec<Backlink>
pub fn take_backlinks(&mut self) -> Vec<Backlink>
Take the Backlink
s in this row. This method consumes the backlinks,
removing them from the row. It is used by
realm_model
to transfer the backlinks to your
custom struct.
Source§impl Row<'_>
impl Row<'_>
Sourcepub fn into_owned(self) -> Row<'static>
pub fn into_owned(self) -> Row<'static>
Convert this row into an owned row.
By default, when you load a row, the names of the columns are borrowed from the columns in the originating table. This can be inconvenient for lifetime reasons, so this method allows you to sever that connection, by cloning the column names.
Note that this is only necessary if you want to interact with the row
manually. If you use realm_model!
, the column
names are no longer used.