From 080cc42bb1da09059dbc35049a7ded0649961e0c Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 29 Aug 2022 20:52:56 +0200 Subject: feat: implement async functionality --- src/lib.rs | 38 +++++++++----------------------------- 1 file changed, 9 insertions(+), 29 deletions(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 8908143..9fdfa0f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,6 +12,11 @@ pub mod errors; pub mod interfaces; pub mod ptr; +#[cfg(feature = "async")] +pub mod async_di_container; + +#[cfg(feature = "async")] +pub use async_di_container::AsyncDIContainer; pub use di_container::DIContainer; pub use syrette_macros::*; @@ -75,9 +80,8 @@ macro_rules! di_container_bind { /// /// A default factory is a factory that doesn't take any arguments. /// -/// More tedious ways to accomplish what this macro does would either be by using -/// the [`factory`] macro or by manually declaring the interfaces -/// with the [`declare_interface`] macro. +/// The more tedious way to accomplish what this macro does would be by using +/// the [`factory`] macro. /// /// *This macro is only available if Syrette is built with the "factory" feature.* /// @@ -95,43 +99,19 @@ macro_rules! di_container_bind { /// /// declare_default_factory!(dyn IParser); /// ``` -/// -/// The expanded equivelent of this would be -/// -/// ``` -/// # use syrette::declare_default_factory; -/// # -/// trait IParser { -/// // Methods and etc here... -/// } -/// -/// syrette::declare_interface!( -/// syrette::castable_factory::CastableFactory< -/// (), -/// dyn IParser, -/// > -> syrette::interfaces::factory::IFactory<(), dyn IParser> -/// ); -/// -/// syrette::declare_interface!( -/// syrette::castable_factory::CastableFactory< -/// (), -/// dyn IParser, -/// > -> syrette::interfaces::any_factory::AnyFactory -/// ); -/// ``` #[macro_export] #[cfg(feature = "factory")] macro_rules! declare_default_factory { ($interface: ty) => { syrette::declare_interface!( - syrette::castable_factory::CastableFactory< + syrette::castable_factory::blocking::CastableFactory< (), $interface, > -> syrette::interfaces::factory::IFactory<(), $interface> ); syrette::declare_interface!( - syrette::castable_factory::CastableFactory< + syrette::castable_factory::blocking::CastableFactory< (), $interface, > -> syrette::interfaces::any_factory::AnyFactory -- cgit v1.2.3-18-g5258