pub struct ComponentDefinition {
pub names: FxHashSet<String>,
pub is_primary: bool,
pub scope: String,
pub resolved_type_id: TypeId,
pub resolved_type_name: String,
pub constructor: Constructor,
pub cast: CastFunction,
}
Expand description
Definition for a Component registered in a definition registry.
Fields§
§names: FxHashSet<String>
Each component has at least one name, which can be used to request a specific instance. Derive-based components have their name generated from type name by converting it to snake case.
is_primary: bool
With multiple components registered for a given type, one of them can be marked as primary and returned when requesting a single instance.
scope: String
§resolved_type_id: TypeId
Concrete component type id. Since aliases can share definitions with their targets, there can be a need to find out what is the leaf type.
resolved_type_name: String
Human-readable type name for reporting purposes.
constructor: Constructor
Constructor method for type-erased instances.
cast: CastFunction
Cast function associated for given type. Please see the documentation for CastFunction for details on usage.
Trait Implementations§
Source§impl Clone for ComponentDefinition
impl Clone for ComponentDefinition
Source§fn clone(&self) -> ComponentDefinition
fn clone(&self) -> ComponentDefinition
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 ComponentDefinition
impl RefUnwindSafe for ComponentDefinition
impl Send for ComponentDefinition
impl Sync for ComponentDefinition
impl Unpin for ComponentDefinition
impl UnwindSafe for ComponentDefinition
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more