pub enum DiError {
NotFound {
type_name: &'static str,
type_id: TypeId,
},
CircularDependency {
type_name: &'static str,
},
CreationFailed {
type_name: &'static str,
reason: String,
},
Locked,
AlreadyRegistered {
type_name: &'static str,
},
ParentDropped,
Internal(String),
}Expand description
Errors that can occur during dependency injection operations
Variants§
NotFound
Service was not found in the container
CircularDependency
Circular dependency detected during resolution
CreationFailed
Factory failed to create service
Locked
Container is locked and cannot be modified
AlreadyRegistered
Attempted to register duplicate service
ParentDropped
Parent scope was dropped
Internal(String)
Internal error
Implementations§
Source§impl DiError
impl DiError
Sourcepub fn creation_failed<T: 'static>(reason: impl Into<String>) -> Self
pub fn creation_failed<T: 'static>(reason: impl Into<String>) -> Self
Create a CreationFailed error
Sourcepub fn already_registered<T: 'static>() -> Self
pub fn already_registered<T: 'static>() -> Self
Create an AlreadyRegistered error
Trait Implementations§
Source§impl Error for DiError
impl Error for DiError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for DiError
impl RefUnwindSafe for DiError
impl Send for DiError
impl Sync for DiError
impl Unpin for DiError
impl UnwindSafe for DiError
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