pub trait ComponentRegistry {
// Required methods
fn get_component_ref<T>(&self) -> Option<ComponentRef<T>>
where T: Any + Send + Sync;
fn get_component<T>(&self) -> Option<T>
where T: Clone + Send + Sync + 'static;
fn has_component<T>(&self) -> bool
where T: Any + Send + Sync;
// Provided methods
fn get_expect_component_ref<T>(&self) -> ComponentRef<T>
where T: Clone + Send + Sync + 'static { ... }
fn try_get_component_ref<T>(&self) -> Result<ComponentRef<T>>
where T: Clone + Send + Sync + 'static { ... }
fn get_expect_component<T>(&self) -> T
where T: Clone + Send + Sync + 'static { ... }
fn try_get_component<T>(&self) -> Result<T>
where T: Clone + Send + Sync + 'static { ... }
}
Expand description
Component Registry
Required Methods§
Sourcefn get_component_ref<T>(&self) -> Option<ComponentRef<T>>
fn get_component_ref<T>(&self) -> Option<ComponentRef<T>>
Get the component reference of the specified type
Sourcefn get_component<T>(&self) -> Option<T>
fn get_component<T>(&self) -> Option<T>
Get the component of the specified type
Provided Methods§
Sourcefn get_expect_component_ref<T>(&self) -> ComponentRef<T>
fn get_expect_component_ref<T>(&self) -> ComponentRef<T>
Get the component reference of the specified type. If the component does not exist, it will panic.
Sourcefn try_get_component_ref<T>(&self) -> Result<ComponentRef<T>>
fn try_get_component_ref<T>(&self) -> Result<ComponentRef<T>>
Get the component reference of the specified type. If the component does not exist, it will return AppError::ComponentNotExist.
Sourcefn get_expect_component<T>(&self) -> T
fn get_expect_component<T>(&self) -> T
Get the component of the specified type. If the component does not exist, it will panic.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.