From 0b4232d343e2214ead8fa62583bff2e948173ddf Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 20 Aug 2023 17:01:12 +0200 Subject: feat: expose DI container get_bound methods to public API --- src/di_container/mod.rs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/di_container/mod.rs') diff --git a/src/di_container/mod.rs b/src/di_container/mod.rs index 5820bc8..63733f5 100644 --- a/src/di_container/mod.rs +++ b/src/di_container/mod.rs @@ -6,5 +6,38 @@ pub mod asynchronous; pub mod blocking; +/// DI container binding options. +/// +/// # Examples +/// ``` +/// # use syrette::di_container::BindingOptions; +/// # +/// BindingOptions::new().name("foo"); +/// ``` +#[derive(Debug, Default, Clone)] +pub struct BindingOptions<'a> +{ + name: Option<&'a str>, +} + +impl<'a> BindingOptions<'a> +{ + /// Returns a new `BindingOptions`. + #[must_use] + pub fn new() -> Self + { + Self { name: None } + } + + /// Returns `Self` with the specified name set. + #[must_use] + pub fn name(mut self, name: &'a str) -> Self + { + self.name = Some(name); + + self + } +} + // Private. pub(crate) mod binding_storage; -- cgit v1.2.3-18-g5258