pub struct ReflectFromWorld(/* private fields */);
bevy_reflect
only.Expand description
A struct used to operate on the reflected FromWorld
trait of a type.
A ReflectFromWorld
for type T
can be obtained via
bevy_reflect::TypeRegistration::data
.
Implementations§
Source§impl ReflectFromWorld
impl ReflectFromWorld
Sourcepub fn from_world(&self, world: &mut World) -> Box<dyn Reflect>
pub fn from_world(&self, world: &mut World) -> Box<dyn Reflect>
Constructs default reflected FromWorld
from world using from_world()
.
Sourcepub fn new(fns: ReflectFromWorldFns) -> Self
pub fn new(fns: ReflectFromWorldFns) -> Self
Create a custom implementation of ReflectFromWorld
.
This is an advanced feature, useful for scripting implementations, that should not be used by most users unless you know what you are doing.
Usually you should derive Reflect
and add the #[reflect(FromWorld)]
bundle
to generate a ReflectFromWorld
implementation automatically.
See ReflectFromWorldFns
for more information.
Sourcepub fn fn_pointers(&self) -> &ReflectFromWorldFns
pub fn fn_pointers(&self) -> &ReflectFromWorldFns
The underlying function pointers implementing methods on ReflectFromWorld
.
This is useful when you want to keep track locally of an individual function pointer.
Calling TypeRegistry::get
followed by
TypeRegistration::data::<ReflectFromWorld>
can be costly if done several
times per frame. Consider cloning ReflectFromWorld
and keeping it
between frames, cloning a ReflectFromWorld
is very cheap.
If you only need a subset of the methods on ReflectFromWorld
,
use fn_pointers
to get the underlying ReflectFromWorldFns
and copy the subset of function pointers you care about.
Trait Implementations§
Source§impl Clone for ReflectFromWorld
impl Clone for ReflectFromWorld
Source§fn clone(&self) -> ReflectFromWorld
fn clone(&self) -> ReflectFromWorld
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 ReflectFromWorld
impl RefUnwindSafe for ReflectFromWorld
impl Send for ReflectFromWorld
impl Sync for ReflectFromWorld
impl Unpin for ReflectFromWorld
impl UnwindSafe for ReflectFromWorld
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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.