pub struct ConstraintManager { /* private fields */ }Implementations§
Source§impl ConstraintManager
impl ConstraintManager
pub fn new() -> Self
pub fn add_constraint(&mut self, constraint: Constraint)
pub fn get_constraints(&self, entity: &str) -> &[Constraint]
Sourcepub fn validate_create(
&self,
entity: &Entity,
_batch: &mut BatchWriter,
storage: &Storage,
) -> Result<()>
pub fn validate_create( &self, entity: &Entity, _batch: &mut BatchWriter, storage: &Storage, ) -> Result<()>
§Errors
Returns an error if any constraint is violated.
Sourcepub fn validate_update(
&self,
entity: &Entity,
old_entity: &Entity,
_batch: &mut BatchWriter,
storage: &Storage,
) -> Result<()>
pub fn validate_update( &self, entity: &Entity, old_entity: &Entity, _batch: &mut BatchWriter, storage: &Storage, ) -> Result<()>
§Errors
Returns an error if any constraint is violated.
Sourcepub fn validate_delete(
&self,
entity: &Entity,
storage: &Storage,
ownership_ctx: Option<&OwnershipContext<'_>>,
) -> Result<Vec<DeleteOperation>>
pub fn validate_delete( &self, entity: &Entity, storage: &Storage, ownership_ctx: Option<&OwnershipContext<'_>>, ) -> Result<Vec<DeleteOperation>>
§Errors
Returns an error if a foreign key constraint prevents deletion.
Sourcepub fn persist_constraint(
&self,
batch: &mut BatchWriter,
constraint: &Constraint,
) -> Result<()>
pub fn persist_constraint( &self, batch: &mut BatchWriter, constraint: &Constraint, ) -> Result<()>
§Errors
Returns an error if serialization fails.
Sourcepub fn load_constraints(&mut self, storage: &Storage) -> Result<()>
pub fn load_constraints(&mut self, storage: &Storage) -> Result<()>
§Errors
Returns an error if reading or deserializing constraints fails.
pub fn entity_names(&self) -> Vec<String>
pub fn all_constraints(&self) -> &HashMap<String, Vec<Constraint>>
pub fn remove_constraint( &mut self, batch: &mut BatchWriter, entity: &str, name: &str, )
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConstraintManager
impl RefUnwindSafe for ConstraintManager
impl Send for ConstraintManager
impl Sync for ConstraintManager
impl Unpin for ConstraintManager
impl UnsafeUnpin for ConstraintManager
impl UnwindSafe for ConstraintManager
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