DiError

Enum DiError 

Source
pub enum DiError {
    ServiceNotRegistered {
        type_name: String,
    },
    KeyedServiceNotRegistered {
        type_name: String,
        key: String,
    },
    CircularDependency {
        type_name: String,
    },
    ScopeDisposed,
    ServiceCreationFailed {
        type_name: String,
        reason: String,
    },
    ServiceAlreadyRegistered {
        type_name: String,
    },
    TypeCastingFailed {
        type_name: String,
    },
    ScopedServiceInRootContainer {
        type_name: String,
    },
    Generic {
        message: String,
    },
}
Expand description

Error types for the dependency injection framework

Variants§

§

ServiceNotRegistered

Service not registered

Fields

§type_name: String
§

KeyedServiceNotRegistered

Keyed service not registered

Fields

§type_name: String
§

CircularDependency

Circular dependency detected

Fields

§type_name: String
§

ScopeDisposed

Scope has been disposed

§

ServiceCreationFailed

Service creation failed

Fields

§type_name: String
§reason: String
§

ServiceAlreadyRegistered

Service already registered

Fields

§type_name: String
§

TypeCastingFailed

Type casting failed

Fields

§type_name: String
§

ScopedServiceInRootContainer

Scoped service resolved from root container

Fields

§type_name: String
§

Generic

Generic error

Fields

§message: String

Implementations§

Source§

impl DiError

Source

pub fn service_not_registered<T: 'static>() -> Self

Create service not registered error from TypeId

Source

pub fn keyed_service_not_registered<T: 'static>(key: &str) -> Self

Create keyed service not registered error from TypeId

Source

pub fn circular_dependency<T: 'static>() -> Self

Create circular dependency error from TypeId

Source

pub fn service_creation_failed<T: 'static>(reason: &str) -> Self

Create service creation failed error from TypeId

Source

pub fn service_already_registered<T: 'static>() -> Self

Create service already registered error from TypeId

Source

pub fn type_casting_failed<T: 'static>() -> Self

Create type casting failed error from TypeId

Source

pub fn scoped_service_in_root_container<T: 'static>() -> Self

Create scoped service in root container error from TypeId

Source

pub fn generic(message: &str) -> Self

Create generic error

Trait Implementations§

Source§

impl Debug for DiError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for DiError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for DiError

1.30.0§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> ToString for T
where T: Display + ?Sized,

§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.