pub trait TypedComponentInstanceProvider {
// Required methods
fn primary_instance_typed<T: Injectable + ?Sized>(
&mut self,
) -> Result<ComponentInstancePtr<T>, ComponentInstanceProviderError>;
fn primary_instance_option<T: Injectable + ?Sized>(
&mut self,
) -> Result<Option<ComponentInstancePtr<T>>, ComponentInstanceProviderError>;
fn instances_typed<T: Injectable + ?Sized>(
&mut self,
) -> Result<Vec<ComponentInstancePtr<T>>, ComponentInstanceProviderError>;
fn instance_by_name_typed<T: Injectable + ?Sized>(
&mut self,
name: &str,
) -> Result<ComponentInstancePtr<T>, ComponentInstanceProviderError>;
fn instance_by_name_option<T: Injectable + ?Sized>(
&mut self,
name: &str,
) -> Result<Option<ComponentInstancePtr<T>>, ComponentInstanceProviderError>;
}Expand description
Helper trait for ComponentInstanceProvider providing strongly-typed access.
Required Methods§
Sourcefn primary_instance_typed<T: Injectable + ?Sized>(
&mut self,
) -> Result<ComponentInstancePtr<T>, ComponentInstanceProviderError>
fn primary_instance_typed<T: Injectable + ?Sized>( &mut self, ) -> Result<ComponentInstancePtr<T>, ComponentInstanceProviderError>
Typesafe version of ComponentInstanceProvider::primary_instance.
Sourcefn primary_instance_option<T: Injectable + ?Sized>(
&mut self,
) -> Result<Option<ComponentInstancePtr<T>>, ComponentInstanceProviderError>
fn primary_instance_option<T: Injectable + ?Sized>( &mut self, ) -> Result<Option<ComponentInstancePtr<T>>, ComponentInstanceProviderError>
Tries to get an instance like TypedComponentInstanceProvider::primary_instance_typed does,
but returns None on missing instance.
Sourcefn instances_typed<T: Injectable + ?Sized>(
&mut self,
) -> Result<Vec<ComponentInstancePtr<T>>, ComponentInstanceProviderError>
fn instances_typed<T: Injectable + ?Sized>( &mut self, ) -> Result<Vec<ComponentInstancePtr<T>>, ComponentInstanceProviderError>
Typesafe version of ComponentInstanceProvider::instances.
Sourcefn instance_by_name_typed<T: Injectable + ?Sized>(
&mut self,
name: &str,
) -> Result<ComponentInstancePtr<T>, ComponentInstanceProviderError>
fn instance_by_name_typed<T: Injectable + ?Sized>( &mut self, name: &str, ) -> Result<ComponentInstancePtr<T>, ComponentInstanceProviderError>
Typesafe version of ComponentInstanceProvider::instance_by_name.
Sourcefn instance_by_name_option<T: Injectable + ?Sized>(
&mut self,
name: &str,
) -> Result<Option<ComponentInstancePtr<T>>, ComponentInstanceProviderError>
fn instance_by_name_option<T: Injectable + ?Sized>( &mut self, name: &str, ) -> Result<Option<ComponentInstancePtr<T>>, ComponentInstanceProviderError>
Tries to get an instance like TypedComponentInstanceProvider::instance_by_name_typed does,
but returns None on missing instance.
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.