diff options
| author | HampusM <hampus@hampusmat.com> | 2022-08-02 20:01:49 +0200 | 
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2022-08-02 20:01:49 +0200 | 
| commit | 3db388dd567fbabb6a88ee7100de65442089c3f1 (patch) | |
| tree | d10b4a0c5b644ec700d20f6cd19d87db189e20f7 | |
| parent | 02f47533799224d114b6e3106f30f2282b092b3d (diff) | |
docs: fix DI container module documentation
| -rw-r--r-- | src/di_container.rs | 88 | 
1 files changed, 44 insertions, 44 deletions
| diff --git a/src/di_container.rs b/src/di_container.rs index 5ee1c52..e15d921 100644 --- a/src/di_container.rs +++ b/src/di_container.rs @@ -1,48 +1,48 @@  //! Dependency injection container and other related utilities. -/// -/// # Examples -/// ``` -/// use std::collections::HashMap; -/// -/// use syrette::{DIContainer, injectable}; -/// use syrette::errors::di_container::DIContainerError; -/// -/// trait IDatabaseService -/// { -///     fn get_all_records(&self, table_name: String) -> HashMap<String, String>; -/// } -/// -/// struct DatabaseService {} -/// -/// #[injectable(IDatabaseService)] -/// impl DatabaseService -/// { -///     fn new() -> Self -///     { -///         Self {} -///     } -/// } -/// -/// impl IDatabaseService for DatabaseService -/// { -///     fn get_all_records(&self, table_name: String) -> HashMap<String, String> -///     { -///         // Do stuff here -///         HashMap::<String, String>::new() -///     } -/// } -/// -/// fn main() -> error_stack::Result<(), DIContainerError> -/// { -///     let mut di_container = DIContainer::new(); -/// -///     di_container.bind::<dyn IDatabaseService>().to::<DatabaseService>(); -/// -///     let database_service = di_container.get::<dyn IDatabaseService>()?; -/// -///     Ok(()) -/// } -/// ``` +//! +//! # Examples +//! ``` +//! use std::collections::HashMap; +//! +//! use syrette::{DIContainer, injectable}; +//! use syrette::errors::di_container::DIContainerError; +//! +//! trait IDatabaseService +//! { +//!     fn get_all_records(&self, table_name: String) -> HashMap<String, String>; +//! } +//! +//! struct DatabaseService {} +//! +//! #[injectable(IDatabaseService)] +//! impl DatabaseService +//! { +//!     fn new() -> Self +//!     { +//!         Self {} +//!     } +//! } +//! +//! impl IDatabaseService for DatabaseService +//! { +//!     fn get_all_records(&self, table_name: String) -> HashMap<String, String> +//!     { +//!         // Do stuff here +//!         HashMap::<String, String>::new() +//!     } +//! } +//! +//! fn main() -> error_stack::Result<(), DIContainerError> +//! { +//!     let mut di_container = DIContainer::new(); +//! +//!     di_container.bind::<dyn IDatabaseService>().to::<DatabaseService>(); +//! +//!     let database_service = di_container.get::<dyn IDatabaseService>()?; +//! +//!     Ok(()) +//! } +//! ```  use std::any::type_name;  use std::marker::PhantomData; | 
