pub struct RequiredComponentsRegistrator<'a, 'w> { /* private fields */ }Expand description
This is a safe handle around ComponentsRegistrator and RequiredComponents to register required components.
Implementations§
Source§impl<'a, 'w> RequiredComponentsRegistrator<'a, 'w>
impl<'a, 'w> RequiredComponentsRegistrator<'a, 'w>
Sourcepub fn components_registrator(&mut self) -> &mut ComponentsRegistrator<'w>
pub fn components_registrator(&mut self) -> &mut ComponentsRegistrator<'w>
Provides access to the current World’s ComponentsRegistrator
Sourcepub fn register_required<C: Component>(
&mut self,
constructor: impl Fn() -> C + 'static,
)
pub fn register_required<C: Component>( &mut self, constructor: impl Fn() -> C + 'static, )
Registers the Component C as an explicitly required component.
If the component was not already registered as an explicit required component then it is added as one, potentially overriding the constructor of an inherited required component, otherwise panics.
Sourcepub unsafe fn register_required_by_id<C: Component>(
&mut self,
component_id: ComponentId,
constructor: impl Fn() -> C + 'static,
)
pub unsafe fn register_required_by_id<C: Component>( &mut self, component_id: ComponentId, constructor: impl Fn() -> C + 'static, )
Registers the Component with the given component_id ID as an explicitly required component.
If the component was not already registered as an explicit required component then it is added as one, potentially overriding the constructor of an inherited required component, otherwise panics.
§Safety
component_id must be a valid ComponentId for C in the Components instance of self.
Sourcepub unsafe fn register_required_dynamic_with(
&mut self,
component_id: ComponentId,
constructor: impl FnOnce() -> RequiredComponentConstructor,
)
pub unsafe fn register_required_dynamic_with( &mut self, component_id: ComponentId, constructor: impl FnOnce() -> RequiredComponentConstructor, )
Registers the Component with the given component_id ID as an explicitly required component.
If the component was not already registered as an explicit required component then it is added as one, potentially overriding the constructor of an inherited required component, otherwise panics.
§Safety
component_idmust be valid in theComponentsinstance ofself;constructormust return aRequiredComponentConstructorthat constructs a valid instance for the component with IDcomponent_id.
Auto Trait Implementations§
impl<'a, 'w> !RefUnwindSafe for RequiredComponentsRegistrator<'a, 'w>
impl<'a, 'w> !Send for RequiredComponentsRegistrator<'a, 'w>
impl<'a, 'w> !Sync for RequiredComponentsRegistrator<'a, 'w>
impl<'a, 'w> !UnwindSafe for RequiredComponentsRegistrator<'a, 'w>
impl<'a, 'w> Freeze for RequiredComponentsRegistrator<'a, 'w>
impl<'a, 'w> Unpin for RequiredComponentsRegistrator<'a, 'w>
impl<'a, 'w> UnsafeUnpin for RequiredComponentsRegistrator<'a, 'w>
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.