pub struct ConsumeEffectBehaviorRegistry {
behaviors: Vec<Box<dyn ConsumeEffectBehavior>>,
}Expand description
Registry for consume-effect behaviors.
Created after the main registry is frozen. All consume-effect types are initialized with a default no-op behavior, then custom behaviors are registered.
Fields§
§behaviors: Vec<Box<dyn ConsumeEffectBehavior>>Implementations§
Source§impl ConsumeEffectBehaviorRegistry
impl ConsumeEffectBehaviorRegistry
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new behavior registry with default behaviors for all consume-effect types.
Sourcepub fn set_behavior(
&mut self,
effect_type: ConsumeEffectTypeRef,
behavior: Box<dyn ConsumeEffectBehavior>,
)
pub fn set_behavior( &mut self, effect_type: ConsumeEffectTypeRef, behavior: Box<dyn ConsumeEffectBehavior>, )
Sets a custom behavior for a consume-effect type.
§Panics
Panics if effect_type is not registered in the global registry.
Sourcepub fn get_behavior(
&self,
effect_type: ConsumeEffectTypeRef,
) -> &dyn ConsumeEffectBehavior
pub fn get_behavior( &self, effect_type: ConsumeEffectTypeRef, ) -> &dyn ConsumeEffectBehavior
Gets the behavior for a consume-effect type.
§Panics
Panics if effect_type is not registered in the global registry.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ConsumeEffectBehaviorRegistry
impl !UnwindSafe for ConsumeEffectBehaviorRegistry
impl Freeze for ConsumeEffectBehaviorRegistry
impl Send for ConsumeEffectBehaviorRegistry
impl Sync for ConsumeEffectBehaviorRegistry
impl Unpin for ConsumeEffectBehaviorRegistry
impl UnsafeUnpin for ConsumeEffectBehaviorRegistry
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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 moreWraps this value in an
Arc<SyncMutex<>>