pub struct ReflectComponentFns {
pub insert: fn(&mut EntityWorldMut<'_>, &(dyn PartialReflect + 'static), &TypeRegistry),
pub apply: fn(EntityMut<'_>, &(dyn PartialReflect + 'static)),
pub apply_or_insert_mapped: fn(&mut EntityWorldMut<'_>, &(dyn PartialReflect + 'static), &TypeRegistry, &mut dyn EntityMapper, RelationshipHookMode),
pub remove: fn(&mut EntityWorldMut<'_>),
pub contains: fn(FilteredEntityRef<'_, '_>) -> bool,
pub reflect: for<'w> fn(FilteredEntityRef<'w, '_>) -> Option<&'w (dyn Reflect + 'static)>,
pub reflect_mut: for<'w> fn(FilteredEntityMut<'w, '_>) -> Option<Mut<'w, dyn Reflect>>,
pub map_entities: fn(&mut (dyn Reflect + 'static), &mut dyn EntityMapper),
pub reflect_unchecked_mut: unsafe fn(UnsafeEntityCell<'_>) -> Option<Mut<'_, dyn Reflect>>,
pub copy: fn(&World, &mut World, Entity, Entity, &TypeRegistry),
pub register_component: fn(&mut World) -> ComponentId,
}Expand description
The raw function pointers needed to make up a ReflectComponent.
This is used when creating custom implementations of ReflectComponent with
ReflectComponent::new().
Note: Creating custom implementations of
ReflectComponentis an advanced feature that most users will not need. Usually aReflectComponentis created for a type by derivingReflectand adding the#[reflect(Component)]attribute. After adding the component to theTypeRegistry, itsReflectComponentcan then be retrieved when needed.
Creating a custom ReflectComponent may be useful if you need to create new component types
at runtime, for example, for scripting implementations.
By creating a custom ReflectComponent and inserting it into a type’s
TypeRegistration,
you can modify the way that reflected components of that type will be inserted into the Bevy
world.
Fields§
§insert: fn(&mut EntityWorldMut<'_>, &(dyn PartialReflect + 'static), &TypeRegistry)Function pointer implementing ReflectComponent::insert().
apply: fn(EntityMut<'_>, &(dyn PartialReflect + 'static))Function pointer implementing ReflectComponent::apply().
apply_or_insert_mapped: fn(&mut EntityWorldMut<'_>, &(dyn PartialReflect + 'static), &TypeRegistry, &mut dyn EntityMapper, RelationshipHookMode)Function pointer implementing ReflectComponent::apply_or_insert_mapped().
remove: fn(&mut EntityWorldMut<'_>)Function pointer implementing ReflectComponent::remove().
contains: fn(FilteredEntityRef<'_, '_>) -> boolFunction pointer implementing ReflectComponent::contains().
reflect: for<'w> fn(FilteredEntityRef<'w, '_>) -> Option<&'w (dyn Reflect + 'static)>Function pointer implementing ReflectComponent::reflect().
reflect_mut: for<'w> fn(FilteredEntityMut<'w, '_>) -> Option<Mut<'w, dyn Reflect>>Function pointer implementing ReflectComponent::reflect_mut().
map_entities: fn(&mut (dyn Reflect + 'static), &mut dyn EntityMapper)Function pointer implementing ReflectComponent::map_entities().
reflect_unchecked_mut: unsafe fn(UnsafeEntityCell<'_>) -> Option<Mut<'_, dyn Reflect>>Function pointer implementing ReflectComponent::reflect_unchecked_mut().
§Safety
The function may only be called with an UnsafeEntityCell that can be used to mutably access the relevant component on the given entity.
copy: fn(&World, &mut World, Entity, Entity, &TypeRegistry)Function pointer implementing ReflectComponent::copy().
register_component: fn(&mut World) -> ComponentIdFunction pointer implementing ReflectComponent::register_component().
Implementations§
Source§impl ReflectComponentFns
impl ReflectComponentFns
Sourcepub fn new<T>() -> ReflectComponentFns
pub fn new<T>() -> ReflectComponentFns
Get the default set of ReflectComponentFns for a specific component type using its
FromType implementation.
This is useful if you want to start with the default implementation before overriding some of the functions to create a custom implementation.
Trait Implementations§
Source§impl Clone for ReflectComponentFns
impl Clone for ReflectComponentFns
Source§fn clone(&self) -> ReflectComponentFns
fn clone(&self) -> ReflectComponentFns
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ReflectComponentFns
impl RefUnwindSafe for ReflectComponentFns
impl Send for ReflectComponentFns
impl Sync for ReflectComponentFns
impl Unpin for ReflectComponentFns
impl UnwindSafe for ReflectComponentFns
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.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>. Box<dyn Any> can
then be further downcast into Box<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>. Rc<Any> 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.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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> ⓘ
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> ⓘ
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