diff options
Diffstat (limited to 'src/di_container.rs')
-rw-r--r-- | src/di_container.rs | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/di_container.rs b/src/di_container.rs new file mode 100644 index 0000000..4e60505 --- /dev/null +++ b/src/di_container.rs @@ -0,0 +1,43 @@ +//! Dependency injection container types. + +#[cfg(feature = "async")] +#[cfg_attr(doc_cfg, doc(cfg(feature = "async")))] +pub mod asynchronous; + +pub mod blocking; + +/// DI container binding options. +/// +/// # Examples +/// ``` +/// # use syrette::di_container::BindingOptions; +/// # +/// BindingOptions::new().name("foo"); +/// ``` +#[derive(Debug, Default, Clone, PartialEq, Eq, Hash)] +pub struct BindingOptions<'a> +{ + name: Option<&'a str>, +} + +impl<'a> BindingOptions<'a> +{ + /// Returns a new `BindingOptions`. + #[must_use] + pub const fn new() -> Self + { + Self { name: None } + } + + /// Returns `Self` with the specified name set. + #[must_use] + pub const fn name(mut self, name: &'a str) -> Self + { + self.name = Some(name); + + self + } +} + +// Private. +pub(crate) mod binding_storage; |