Trait bevy::reflect::Reflect [−]
pub unsafe trait Reflect: Any + Send + Sync {
fn type_name(&self) -> &str;
fn any(&self) -> &(dyn Any + 'static);
fn any_mut(&mut self) -> &mut (dyn Any + 'static);
fn apply(&mut self, value: &(dyn Reflect + 'static));
fn set(
&mut self,
value: Box<dyn Reflect + 'static, Global>
) -> Result<(), Box<dyn Reflect + 'static, Global>>;
fn reflect_ref(&self) -> ReflectRef<'_>;
fn reflect_mut(&mut self) -> ReflectMut<'_>;
fn clone_value(&self) -> Box<dyn Reflect + 'static, Global>ⓘ;
fn reflect_hash(&self) -> Option<u64>;
fn reflect_partial_eq(
&self,
_value: &(dyn Reflect + 'static)
) -> Option<bool>;
fn serializable(&self) -> Option<Serializable<'_>>;
}
Expand description
A reflected rust type.
Safety
Implementors must ensure that Reflect::any
and Reflect::any_mut
both return the self
value passed in If this is not done, Reflect::downcast
will be UB (and also just logically broken).
Required methods
fn set(
&mut self,
value: Box<dyn Reflect + 'static, Global>
) -> Result<(), Box<dyn Reflect + 'static, Global>>
fn reflect_ref(&self) -> ReflectRef<'_>
fn reflect_mut(&mut self) -> ReflectMut<'_>
fn clone_value(&self) -> Box<dyn Reflect + 'static, Global>ⓘ
fn reflect_hash(&self) -> Option<u64>
fn reflect_hash(&self) -> Option<u64>
Returns a hash of the value (which includes the type) if hashing is supported. Otherwise
None
will be returned.
fn reflect_partial_eq(&self, _value: &(dyn Reflect + 'static)) -> Option<bool>
fn reflect_partial_eq(&self, _value: &(dyn Reflect + 'static)) -> Option<bool>
Returns a “partial equal” comparison result if comparison is supported. Otherwise None
will be returned.
fn serializable(&self) -> Option<Serializable<'_>>
fn serializable(&self) -> Option<Serializable<'_>>
Returns a serializable value, if serialization is supported. Otherwise None
will be
returned.