aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-08-29 20:52:56 +0200
committerHampusM <hampus@hampusmat.com>2022-08-29 21:01:32 +0200
commit080cc42bb1da09059dbc35049a7ded0649961e0c (patch)
tree307ee564124373616022c1ba2b4d5af80845cd92 /src/lib.rs
parent6e31d8f9e46fece348f329763b39b9c6f2741c07 (diff)
feat: implement async functionality
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs38
1 files changed, 9 insertions, 29 deletions
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