pub struct LinearEffectTracker { /* private fields */ }Expand description
Tracks usage of linear (one-shot) effects to ensure they are used exactly once.
Implementations§
Source§impl LinearEffectTracker
impl LinearEffectTracker
Sourcepub fn use_effect(&mut self, effect: &str)
pub fn use_effect(&mut self, effect: &str)
Record one use of the given effect.
Sourcepub fn check_linear(&self, effect: &str) -> bool
pub fn check_linear(&self, effect: &str) -> bool
Check whether a linear effect was used exactly once.
Sourcepub fn verify_all_linear(&self) -> bool
pub fn verify_all_linear(&self) -> bool
Verify all declared linear effects were used exactly once.
Sourcepub fn usage_count(&self, effect: &str) -> usize
pub fn usage_count(&self, effect: &str) -> usize
Get the usage count of an effect.
Sourcepub fn overused_effects(&self) -> Vec<String>
pub fn overused_effects(&self) -> Vec<String>
Return the list of linear effects that were used more than once (violations).
Sourcepub fn unused_effects(&self) -> Vec<String>
pub fn unused_effects(&self) -> Vec<String>
Return the list of linear effects that were never used (also violations).
Auto Trait Implementations§
impl Freeze for LinearEffectTracker
impl RefUnwindSafe for LinearEffectTracker
impl Send for LinearEffectTracker
impl Sync for LinearEffectTracker
impl Unpin for LinearEffectTracker
impl UnsafeUnpin for LinearEffectTracker
impl UnwindSafe for LinearEffectTracker
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