pub struct BlockBehaviorRegistry {
behaviors: Vec<Box<dyn BlockBehavior>>,
}Expand description
Registry for block behaviors.
Created after the main registry is frozen. All blocks are initialized with default behaviors, then custom behaviors are registered for specific blocks.
Fields§
§behaviors: Vec<Box<dyn BlockBehavior>>Implementations§
Source§impl BlockBehaviorRegistry
impl BlockBehaviorRegistry
Sourcepub fn get_behaviors(&self) -> &[Box<dyn BlockBehavior>]
pub fn get_behaviors(&self) -> &[Box<dyn BlockBehavior>]
Get all behaviors.
Sourcepub fn set_behavior(
&mut self,
block: BlockRef,
behavior: Box<dyn BlockBehavior>,
)
pub fn set_behavior( &mut self, block: BlockRef, behavior: Box<dyn BlockBehavior>, )
Sets a custom behavior for a block.
Sourcepub fn get_behavior(&self, block: BlockRef) -> &dyn BlockBehavior
pub fn get_behavior(&self, block: BlockRef) -> &dyn BlockBehavior
Gets the behavior for a block.
Sourcepub fn get_behavior_for_state(
&self,
state: BlockStateId,
) -> Option<&dyn BlockBehavior>
pub fn get_behavior_for_state( &self, state: BlockStateId, ) -> Option<&dyn BlockBehavior>
Gets the behavior for a block state.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for BlockBehaviorRegistry
impl !UnwindSafe for BlockBehaviorRegistry
impl Freeze for BlockBehaviorRegistry
impl Send for BlockBehaviorRegistry
impl Sync for BlockBehaviorRegistry
impl Unpin for BlockBehaviorRegistry
impl UnsafeUnpin for BlockBehaviorRegistry
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<>>