Trait fyrox_core::type_traits::ComponentProvider
source · pub trait ComponentProvider {
// Required methods
fn query_component_ref(&self, type_id: TypeId) -> Option<&dyn Any>;
fn query_component_mut(&mut self, type_id: TypeId) -> Option<&mut dyn Any>;
}
Expand description
Component provider provides dynamic access to inner components of an object by their type id.
Required Methods§
sourcefn query_component_ref(&self, type_id: TypeId) -> Option<&dyn Any>
fn query_component_ref(&self, type_id: TypeId) -> Option<&dyn Any>
Allows an object to provide access to inner components.
sourcefn query_component_mut(&mut self, type_id: TypeId) -> Option<&mut dyn Any>
fn query_component_mut(&mut self, type_id: TypeId) -> Option<&mut dyn Any>
Allows an object to provide access to inner components.
Implementations§
source§impl dyn ComponentProvider
impl dyn ComponentProvider
sourcepub fn component_ref<T: Any>(&self) -> Option<&T>
pub fn component_ref<T: Any>(&self) -> Option<&T>
Tries to borrow a component of given type.
sourcepub fn component_mut<T: Any>(&mut self) -> Option<&mut T>
pub fn component_mut<T: Any>(&mut self) -> Option<&mut T>
Tries to borrow a component of given type.