aboutsummaryrefslogtreecommitdiff
path: root/src/di_container/blocking/binding/when_configurator.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/di_container/blocking/binding/when_configurator.rs')
-rw-r--r--src/di_container/blocking/binding/when_configurator.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/di_container/blocking/binding/when_configurator.rs b/src/di_container/blocking/binding/when_configurator.rs
index 2a1af2c..d23d213 100644
--- a/src/di_container/blocking/binding/when_configurator.rs
+++ b/src/di_container/blocking/binding/when_configurator.rs
@@ -34,6 +34,34 @@ where
///
/// # Errors
/// Will return Err if no binding for the interface already exists.
+ ///
+ /// # Examples
+ /// ```
+ /// # use syrette::{DIContainer, injectable};
+ /// #
+ /// # struct Kitten {}
+ /// #
+ /// # #[injectable]
+ /// # impl Kitten
+ /// # {
+ /// # fn new() -> Self
+ /// # {
+ /// # Self {}
+ /// # }
+ /// # }
+ /// #
+ /// # fn main() -> Result<(), Box<dyn std::error::Error>> {
+ /// let mut di_container = DIContainer::new();
+ ///
+ /// di_container
+ /// .bind::<Kitten>()
+ /// .to::<Kitten>()?
+ /// .in_transient_scope()
+ /// .when_named("Billy")?;
+ /// #
+ /// # Ok(())
+ /// # }
+ /// ```
pub fn when_named(
self,
name: &'static str,