pub struct ReflectMessageFns {
pub write_message: fn(&mut World, &dyn PartialReflect, &TypeRegistry),
}Expand description
The raw function pointers needed to make up a ReflectMessage.
This is used when creating custom implementations of ReflectMessage with
ReflectMessage::new().
Note: Creating custom implementations of
ReflectMessageis an advanced feature that most users will not need. Usually aReflectMessageis created for a type by derivingReflectand adding the#[reflect(Message)]attribute. After adding the event to theTypeRegistry, itsReflectMessagecan then be retrieved when needed.
Creating a custom ReflectMessage may be useful if you need to create new
message types at runtime, for example, for scripting implementations.
By creating a custom ReflectMessage and inserting it into a type’s
TypeRegistration, you can modify the way
that reflected messages of that type will be written to the Bevy world.
Fields§
§write_message: fn(&mut World, &dyn PartialReflect, &TypeRegistry)Function pointer implementing ReflectMessage::write_message.
Implementations§
Source§impl ReflectMessageFns
impl ReflectMessageFns
Sourcepub fn new<M: Message + FromReflect + TypePath>() -> Self
pub fn new<M: Message + FromReflect + TypePath>() -> Self
Get the default set of ReflectMessageFns for a specific event 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 ReflectMessageFns
impl Clone for ReflectMessageFns
Source§fn clone(&self) -> ReflectMessageFns
fn clone(&self) -> ReflectMessageFns
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 ReflectMessageFns
impl RefUnwindSafe for ReflectMessageFns
impl Send for ReflectMessageFns
impl Sync for ReflectMessageFns
impl Unpin for ReflectMessageFns
impl UnsafeUnpin for ReflectMessageFns
impl UnwindSafe for ReflectMessageFns
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> 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.