diff options
author | HampusM <hampus@hampusmat.com> | 2022-07-09 22:01:25 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-07-09 22:01:25 +0200 |
commit | dda28f312ac87e84b6daed1ace7b2bcc3e47f71d (patch) | |
tree | 163e34b439170f7027be8a2ec77fa533f4bd1c0b /syrette_macros/src | |
parent | b5149091a263b373cb1302d197a79ea94653d826 (diff) |
docs: add documentation comments
Diffstat (limited to 'syrette_macros/src')
-rw-r--r-- | syrette_macros/src/lib.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/syrette_macros/src/lib.rs b/syrette_macros/src/lib.rs index 3fd8a59..faf338c 100644 --- a/syrette_macros/src/lib.rs +++ b/syrette_macros/src/lib.rs @@ -141,6 +141,30 @@ fn get_dependency_types(item_impl: &ItemImpl) -> Vec<Type> ); } +/// Makes a struct injectable. Therefore usable with `DIContainer`. +/// +/// # Arguments +/// +/// * A interface trait the struct implements. +/// +/// # Examples +/// ``` +/// trait IConfigReader +/// { +/// fn read_config() -> Config; +/// } +/// +/// struct ConfigReader {} +/// +/// #[injectable(IConfigReader)] +/// impl IConfigReader for ConfigReader +/// { +/// fn read_config() -> Config +/// { +/// // Stuff here +/// } +/// } +/// ``` #[proc_macro_attribute] pub fn injectable(args_stream: TokenStream, impl_stream: TokenStream) -> TokenStream { @@ -205,6 +229,7 @@ pub fn injectable(args_stream: TokenStream, impl_stream: TokenStream) -> TokenSt .into() } +#[doc(hidden)] #[proc_macro] pub fn castable_to(input: TokenStream) -> TokenStream { |