1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
//! Error types for [`AsyncDIContainer`] and it's related structs.
//!
//! [`AsyncDIContainer`]: crate::di_container::asynchronous::AsyncDIContainer
use crate::errors::injectable::InjectableError;
/// Error type for [`AsyncDIContainer`].
///
/// [`AsyncDIContainer`]: crate::di_container::asynchronous::AsyncDIContainer
#[derive(thiserror::Error, Debug)]
pub enum AsyncDIContainerError
{
/// Unable to cast a binding for a interface.
#[error(
"Unable to cast binding for interface '{interface} with kind '{binding_kind}'"
)]
CastFailed
{
/// The interface.
interface: &'static str,
/// The kind of the found binding.
binding_kind: &'static str,
},
/// Failed to resolve a binding for a interface.
#[error("Failed to resolve binding for interface '{interface}'")]
BindingResolveFailed
{
/// The reason for the problem.
#[source]
reason: InjectableError,
/// The affected bound interface.
interface: &'static str,
},
/// No binding exists for a interface (and optionally a name).
#[error(
"No binding exists for interface '{interface}' {}",
.name.map_or_else(String::new, |name| format!("with name '{name}'"))
)]
BindingNotFound
{
/// The interface that doesn't have a binding.
interface: &'static str,
/// The name of the binding if one exists.
name: Option<&'static str>,
},
/// A interface has not been marked async.
#[error("Interface '{0}' has not been marked async")]
InterfaceNotAsync(&'static str),
}
/// Error type for [`AsyncBindingBuilder`].
///
/// [`AsyncBindingBuilder`]: crate::di_container::asynchronous::binding::builder::AsyncBindingBuilder
#[derive(thiserror::Error, Debug)]
pub enum AsyncBindingBuilderError
{
/// A binding already exists for a interface.
#[error("Binding already exists for interface '{0}'")]
BindingAlreadyExists(&'static str),
}
/// Error type for [`AsyncBindingScopeConfigurator`].
///
/// [`AsyncBindingScopeConfigurator`]: crate::di_container::asynchronous::binding::scope_configurator::AsyncBindingScopeConfigurator
#[derive(thiserror::Error, Debug)]
pub enum AsyncBindingScopeConfiguratorError
{
/// Resolving a singleton failed.
#[error("Resolving the given singleton failed")]
SingletonResolveFailed(#[from] InjectableError),
}
/// Error type for [`AsyncBindingWhenConfigurator`].
///
/// [`AsyncBindingWhenConfigurator`]: crate::di_container::asynchronous::binding::when_configurator::AsyncBindingWhenConfigurator
#[derive(thiserror::Error, Debug)]
pub enum AsyncBindingWhenConfiguratorError
{
/// A binding for a interface wasn't found.
#[error("A binding for interface '{0}' wasn't found'")]
BindingNotFound(&'static str),
}
|