aboutsummaryrefslogtreecommitdiff
path: root/macros/src/lib.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2023-08-04 17:38:00 +0200
committerHampusM <hampus@hampusmat.com>2023-08-04 17:38:00 +0200
commitb4ddc1e626fbd11d784b442d246ddc5f54c35b51 (patch)
treeb8f87926310b8490fce701d17dcd0a612067034d /macros/src/lib.rs
parente0216c7cbf008f2867ef92955abce28dba27f5e3 (diff)
refactor!: rename the async flag of the declare_interface macro
BREAKING CHANGE: The flag 'async' of the declare_interface macro has been renamed to 'threadsafe_sharable'. The reason being that the name 'async' was an outright lie. The new name describes exactly what the flag enables
Diffstat (limited to 'macros/src/lib.rs')
-rw-r--r--macros/src/lib.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/macros/src/lib.rs b/macros/src/lib.rs
index 80274fd..b261974 100644
--- a/macros/src/lib.rs
+++ b/macros/src/lib.rs
@@ -220,14 +220,14 @@ pub fn injectable(args_stream: TokenStream, input_stream: TokenStream) -> TokenS
});
let maybe_decl_interface = if let Some(interface) = opt_interface {
- let async_flag = if is_async {
- quote! {, async = true}
+ let threadsafe_sharable_flag = if is_async {
+ quote! { , threadsafe_sharable = true }
} else {
quote! {}
};
quote! {
- syrette::declare_interface!(#self_type -> #interface #async_flag);
+ syrette::declare_interface!(#self_type -> #interface #threadsafe_sharable_flag);
}
} else {
quote! {}
@@ -443,7 +443,8 @@ pub fn declare_default_factory(args_stream: TokenStream) -> TokenStream
/// * (Zero or more) Flags. Like `a = true, b = false`
///
/// # Flags
-/// - `async` - Mark as async.
+/// - `threadsafe_sharable` - Enables the use of thread-safe shared instances of the
+/// implementation accessed with the interface.
///
/// # Examples
/// ```
@@ -468,9 +469,11 @@ pub fn declare_interface(input: TokenStream) -> TokenStream
flags,
} = parse(input).unwrap_or_abort();
- let opt_async_flag = flags.iter().find(|flag| flag.name() == "async");
+ let threadsafe_sharable_flag = flags
+ .iter()
+ .find(|flag| flag.name() == "threadsafe_sharable");
- let is_async = opt_async_flag
+ let is_async = threadsafe_sharable_flag
.map_or_else(|| Ok(false), MacroFlag::get_bool)
.unwrap_or_abort();