Struct bevy_ecs::reflect::ReflectFromWorld
source · pub struct ReflectFromWorld(/* private fields */);
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> 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.