aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-08-28 13:50:15 +0200
committerHampusM <hampus@hampusmat.com>2022-08-28 13:50:15 +0200
commit6e31d8f9e46fece348f329763b39b9c6f2741c07 (patch)
tree1993cd9af613ffe7dcb9a88fcca7f0dbfb28b67b /src/lib.rs
parentf91c4ce73786a69e4ec72f69ef4d9d5f03ac5886 (diff)
docs: improve & add examples
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/lib.rs b/src/lib.rs
index cac6ffe..8908143 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -38,6 +38,30 @@ mod provider;
///
/// # Arguments
/// {interface} => {implementation}, {DI container variable name}
+///
+/// # Examples
+/// ```
+/// # use syrette::{di_container_bind, DIContainer, injectable};
+/// #
+/// # trait INinja {}
+/// #
+/// # struct Ninja {}
+/// #
+/// # #[injectable]
+/// # impl Ninja
+/// # {
+/// # fn new() -> Self
+/// # {
+/// # Self {}
+/// # }
+/// # }
+/// #
+/// # impl INinja for Ninja {}
+/// #
+/// let mut di_container = DIContainer::new();
+///
+/// di_container_bind!(INinja => Ninja, di_container);
+/// ```
#[macro_export]
macro_rules! di_container_bind {
($interface: path => $implementation: ty, $di_container: ident) => {
@@ -62,8 +86,8 @@ macro_rules! di_container_bind {
///
/// # Examples
/// ```
-/// use syrette::declare_default_factory;
-///
+/// # use syrette::declare_default_factory;
+/// #
/// trait IParser
/// {
/// // Methods and etc here...
@@ -75,8 +99,8 @@ macro_rules! di_container_bind {
/// The expanded equivelent of this would be
///
/// ```
-/// use syrette::declare_default_factory;
-///
+/// # use syrette::declare_default_factory;
+/// #
/// trait IParser {
/// // Methods and etc here...
/// }