From dda28f312ac87e84b6daed1ace7b2bcc3e47f71d Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 9 Jul 2022 22:01:25 +0200 Subject: docs: add documentation comments --- syrette_macros/src/lib.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'syrette_macros/src/lib.rs') 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 ); } +/// 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 { -- cgit v1.2.3-18-g5258