From 14a91d97c5e2f3184f2b91003ab8e2bc5a92b312 Mon Sep 17 00:00:00 2001 From: HampusM Date: Fri, 2 Sep 2022 18:33:39 +0200 Subject: refactor: rename the factory macro flag 'async' to 'threadsafe' --- macros/src/factory_macro_args.rs | 2 +- macros/src/lib.rs | 6 +++--- src/async_di_container.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/macros/src/factory_macro_args.rs b/macros/src/factory_macro_args.rs index 57517d6..0cf1d66 100644 --- a/macros/src/factory_macro_args.rs +++ b/macros/src/factory_macro_args.rs @@ -5,7 +5,7 @@ use syn::Token; use crate::macro_flag::MacroFlag; use crate::util::iterator_ext::IteratorExt; -pub const FACTORY_MACRO_FLAGS: &[&str] = &["async"]; +pub const FACTORY_MACRO_FLAGS: &[&str] = &["threadsafe"]; pub struct FactoryMacroArgs { diff --git a/macros/src/lib.rs b/macros/src/lib.rs index 3df1750..c9e12b1 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -2,7 +2,7 @@ #![deny(clippy::pedantic)] #![deny(missing_docs)] -//! Macros for the [Sy&rette](https://crates.io/crates/syrette) crate. +//! Macros for the [Syrette](https://crates.io/crates/syrette) crate. use proc_macro::TokenStream; use quote::quote; @@ -157,7 +157,7 @@ pub fn injectable(args_stream: TokenStream, impl_stream: TokenStream) -> TokenSt /// * (Zero or more) Flags. Like `a = true, b = false` /// /// # Flags -/// - `async` - Mark as async. +/// - `threadsafe` - Mark as threadsafe. /// /// # Panics /// If the attributed item is not a type alias. @@ -194,7 +194,7 @@ pub fn factory(args_stream: TokenStream, type_alias_stream: TokenStream) -> Toke let is_async = flags .iter() - .find(|flag| flag.flag.to_string().as_str() == "async") + .find(|flag| flag.flag.to_string().as_str() == "threadsafe") .map_or(false, |flag| flag.is_on.value); let factory_type_alias::FactoryTypeAlias { diff --git a/src/async_di_container.rs b/src/async_di_container.rs index 23eb2eb..0e29e4c 100644 --- a/src/async_di_container.rs +++ b/src/async_di_container.rs @@ -1002,7 +1002,7 @@ mod tests use crate as syrette; - #[crate::factory(async = true)] + #[crate::factory(threadsafe = true)] type IUserManagerFactory = dyn crate::interfaces::factory::IFactory<(Vec,), dyn IUserManager>; @@ -1091,7 +1091,7 @@ mod tests use crate as syrette; - #[crate::factory(async = true)] + #[crate::factory(threadsafe = true)] type IUserManagerFactory = dyn crate::interfaces::factory::IFactory<(Vec,), dyn IUserManager>; -- cgit v1.2.3-18-g5258