From b4ddc1e626fbd11d784b442d246ddc5f54c35b51 Mon Sep 17 00:00:00 2001 From: HampusM Date: Fri, 4 Aug 2023 17:38:00 +0200 Subject: 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 --- macros/src/declare_interface_args.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'macros/src/declare_interface_args.rs') diff --git a/macros/src/declare_interface_args.rs b/macros/src/declare_interface_args.rs index 79004da..fea6c7b 100644 --- a/macros/src/declare_interface_args.rs +++ b/macros/src/declare_interface_args.rs @@ -5,7 +5,7 @@ use syn::{Token, TypePath}; use crate::macro_flag::MacroFlag; use crate::util::iterator_ext::IteratorExt; -pub const DECLARE_INTERFACE_FLAGS: &[&str] = &["async"]; +pub const DECLARE_INTERFACE_FLAGS: &[&str] = &["threadsafe_sharable"]; pub struct DeclareInterfaceArgs { @@ -110,7 +110,7 @@ mod tests fn can_parse_with_flags() -> Result<(), Box> { let input_args = quote! { - Foobar -> IFoobar, async = true + Foobar -> IFoobar, threadsafe_sharable = true }; let decl_interface_args = parse2::(input_args)?; @@ -140,7 +140,7 @@ mod tests assert_eq!( decl_interface_args.flags, Punctuated::from_iter(vec![MacroFlag { - name: format_ident!("async"), + name: format_ident!("threadsafe_sharable"), value: MacroFlagValue::Literal(Lit::Bool(LitBool::new( true, Span::call_site() @@ -155,7 +155,7 @@ mod tests fn cannot_parse_with_invalid_flag() { let input_args = quote! { - Foobar -> IFoobar, xyz = false, async = true + Foobar -> IFoobar, xyz = false, threadsafe_sharable = true }; assert!(parse2::(input_args).is_err()); @@ -167,7 +167,7 @@ mod tests assert!( // Formatting is weird without this comment parse2::(quote! { - Foobar -> IFoobar, async = true, async = true + Foobar -> IFoobar, threadsafe_sharable = true, threadsafe_sharable = true }) .is_err() ); @@ -175,7 +175,7 @@ mod tests assert!( // Formatting is weird without this comment parse2::(quote! { - Foobar -> IFoobar, async = true, async = false + Foobar -> IFoobar, threadsafe_sharable = true, threadsafe_sharable = false }) .is_err() ); -- cgit v1.2.3-18-g5258