pub struct MutationRuleManager { /* private fields */ }Expand description
Manager for mutation rules
Implementations§
Source§impl MutationRuleManager
impl MutationRuleManager
Sourcepub async fn add_rule(&self, rule: MutationRule) -> Result<()>
pub async fn add_rule(&self, rule: MutationRule) -> Result<()>
Add a mutation rule
Sourcepub async fn remove_rule(&self, rule_id: &str) -> bool
pub async fn remove_rule(&self, rule_id: &str) -> bool
Remove a mutation rule
Sourcepub async fn get_rule(&self, rule_id: &str) -> Option<MutationRule>
pub async fn get_rule(&self, rule_id: &str) -> Option<MutationRule>
Get a mutation rule by ID
Sourcepub async fn list_rules(&self) -> Vec<MutationRule>
pub async fn list_rules(&self) -> Vec<MutationRule>
List all mutation rules
Sourcepub async fn list_rules_for_entity(
&self,
entity_name: &str,
) -> Vec<MutationRule>
pub async fn list_rules_for_entity( &self, entity_name: &str, ) -> Vec<MutationRule>
List rules for a specific entity
Sourcepub async fn set_rule_enabled(&self, rule_id: &str, enabled: bool) -> Result<()>
pub async fn set_rule_enabled(&self, rule_id: &str, enabled: bool) -> Result<()>
Enable or disable a mutation rule
Sourcepub async fn check_and_execute(
&self,
database: &dyn VirtualDatabase,
registry: &EntityRegistry,
) -> Result<usize>
pub async fn check_and_execute( &self, database: &dyn VirtualDatabase, registry: &EntityRegistry, ) -> Result<usize>
Check for rules that should execute now and execute them
This should be called periodically or when time advances to check if any rules are due for execution.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MutationRuleManager
impl !RefUnwindSafe for MutationRuleManager
impl Send for MutationRuleManager
impl Sync for MutationRuleManager
impl Unpin for MutationRuleManager
impl UnsafeUnpin for MutationRuleManager
impl !UnwindSafe for MutationRuleManager
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more