pub trait Injectable:
Send
+ Sync
+ 'static {
// Provided methods
fn type_id_of() -> TypeId
where Self: Sized { ... }
fn type_name_of() -> &'static str
where Self: Sized { ... }
}Expand description
Marker trait for types that can be injected via the DI container.
This is automatically implemented for all types that are Send + Sync + 'static.
You never need to implement this manually.
§Examples
// Any type that is Send + Sync + 'static works automatically
#[derive(Clone)]
struct MyService {
name: String,
}
// No impl needed - it just works!Provided Methods§
Sourcefn type_id_of() -> TypeIdwhere
Self: Sized,
fn type_id_of() -> TypeIdwhere
Self: Sized,
Returns the TypeId of this type (for internal use)
Sourcefn type_name_of() -> &'static strwhere
Self: Sized,
fn type_name_of() -> &'static strwhere
Self: Sized,
Returns the type name for debugging