pub struct ProviderRegistration {
pub type_id: TypeId,
pub type_name: &'static str,
pub register_fn: fn(&Container),
}Expand description
Registration information for a provider (used by module system)
Fields§
§type_id: TypeIdTypeId of the provider
type_name: &'static strHuman-readable type name
register_fn: fn(&Container)Registration function
Implementations§
Source§impl ProviderRegistration
impl ProviderRegistration
Sourcepub fn new<T: Injectable>(register_fn: fn(&Container)) -> Self
pub fn new<T: Injectable>(register_fn: fn(&Container)) -> Self
Create a new registration for type T
Sourcepub fn singleton<T: Injectable + Clone>(_value: T) -> Self
pub fn singleton<T: Injectable + Clone>(_value: T) -> Self
Create from a singleton value
Note: This creates a no-op registration. For actual registration,
use Container::singleton() directly.
Trait Implementations§
Source§impl Clone for ProviderRegistration
impl Clone for ProviderRegistration
Source§fn clone(&self) -> ProviderRegistration
fn clone(&self) -> ProviderRegistration
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ProviderRegistration
impl RefUnwindSafe for ProviderRegistration
impl Send for ProviderRegistration
impl Sync for ProviderRegistration
impl Unpin for ProviderRegistration
impl UnwindSafe for ProviderRegistration
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Injectable for T
impl<T> Injectable for T
Source§fn type_id_of() -> TypeIdwhere
Self: Sized,
fn type_id_of() -> TypeIdwhere
Self: Sized,
Returns the TypeId of this type (for internal use)
Source§fn type_name_of() -> &'static strwhere
Self: Sized,
fn type_name_of() -> &'static strwhere
Self: Sized,
Returns the type name for debugging