pub struct Relation<M: Model> { /* private fields */ }
Expand description
A relation is a collection of records of a particular model and some metadata. associated with the relation.
Relation also implements typical CRUD operations, which are used by the database.
Implementations§
Source§impl<M: Model> Relation<M>
impl<M: Model> Relation<M>
Sourcepub fn new_with_records(records: Vec<M>) -> Self
pub fn new_with_records(records: Vec<M>) -> Self
Creates a new relation with the given records.
It needs to be public, since it may be used by custom partitioned adapters (.e.g crate::adapters::CsvAdapter uses it).
Sourcepub fn is_dirty(&self) -> bool
pub fn is_dirty(&self) -> bool
Is there any unsaved changes?
It needs to be public, since it’s invoked by the code generated with crate::state macro.
Sourcepub fn reset_dirty(&mut self)
pub fn reset_dirty(&mut self)
Resets the dirty flag to false
.
It needs to be public, since it’s invoked by the code generated with crate::state macro.
Trait Implementations§
Source§impl<'de, M: Model> Deserialize<'de> for Relation<M>
impl<'de, M: Model> Deserialize<'de> for Relation<M>
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<M> Freeze for Relation<M>
impl<M> RefUnwindSafe for Relation<M>where
M: RefUnwindSafe,
impl<M> Send for Relation<M>where
M: Send,
impl<M> Sync for Relation<M>where
M: Sync,
impl<M> Unpin for Relation<M>where
M: Unpin,
impl<M> UnwindSafe for Relation<M>where
M: UnwindSafe,
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