aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-09-02 18:45:30 +0200
committerHampusM <hampus@hampusmat.com>2022-09-02 18:45:30 +0200
commit40109b5298160795cedca4c8204c8a1dd0bcd0be (patch)
tree083dc34f2824087bda7015b1d9e4eaa5b9445ac3
parent14a91d97c5e2f3184f2b91003ab8e2bc5a92b312 (diff)
refactor!: remove braces from expected injectable macro input
BREAKING CHANGE: The injectable macro no longer expects braces around it's flags
-rw-r--r--examples/async/animals/cat.rs2
-rw-r--r--examples/async/animals/dog.rs2
-rw-r--r--examples/async/animals/human.rs2
-rw-r--r--macros/src/injectable_macro_args.rs8
-rw-r--r--macros/src/lib.rs2
-rw-r--r--src/async_di_container.rs2
6 files changed, 7 insertions, 11 deletions
diff --git a/examples/async/animals/cat.rs b/examples/async/animals/cat.rs
index b1e6f27..7062929 100644
--- a/examples/async/animals/cat.rs
+++ b/examples/async/animals/cat.rs
@@ -4,7 +4,7 @@ use crate::interfaces::cat::ICat;
pub struct Cat {}
-#[injectable(ICat, { async = true })]
+#[injectable(ICat, async = true)]
impl Cat
{
pub fn new() -> Self
diff --git a/examples/async/animals/dog.rs b/examples/async/animals/dog.rs
index d1b33f9..6a4e82b 100644
--- a/examples/async/animals/dog.rs
+++ b/examples/async/animals/dog.rs
@@ -4,7 +4,7 @@ use crate::interfaces::dog::IDog;
pub struct Dog {}
-#[injectable(IDog, { async = true })]
+#[injectable(IDog, async = true)]
impl Dog
{
pub fn new() -> Self
diff --git a/examples/async/animals/human.rs b/examples/async/animals/human.rs
index 140f27c..fc98ed8 100644
--- a/examples/async/animals/human.rs
+++ b/examples/async/animals/human.rs
@@ -11,7 +11,7 @@ pub struct Human
cat: TransientPtr<dyn ICat>,
}
-#[injectable(IHuman, { async = true })]
+#[injectable(IHuman, async = true)]
impl Human
{
pub fn new(dog: ThreadsafeSingletonPtr<dyn IDog>, cat: TransientPtr<dyn ICat>)
diff --git a/macros/src/injectable_macro_args.rs b/macros/src/injectable_macro_args.rs
index 6cc1d7e..50d4087 100644
--- a/macros/src/injectable_macro_args.rs
+++ b/macros/src/injectable_macro_args.rs
@@ -1,6 +1,6 @@
use syn::parse::{Parse, ParseStream};
use syn::punctuated::Punctuated;
-use syn::{braced, Token, TypePath};
+use syn::{Token, TypePath};
use crate::macro_flag::MacroFlag;
use crate::util::iterator_ext::IteratorExt;
@@ -39,11 +39,7 @@ impl Parse for InjectableMacroArgs
});
}
- let braced_content;
-
- braced!(braced_content in input);
-
- let flags = braced_content.parse_terminated(MacroFlag::parse)?;
+ let flags = Punctuated::<MacroFlag, Token![,]>::parse_terminated(input)?;
for flag in &flags {
let flag_str = flag.flag.to_string();
diff --git a/macros/src/lib.rs b/macros/src/lib.rs
index c9e12b1..25f3c5c 100644
--- a/macros/src/lib.rs
+++ b/macros/src/lib.rs
@@ -29,7 +29,7 @@ use libs::intertrait_macros::gen_caster::generate_caster;
///
/// # Arguments
/// * (Optional) A interface trait the struct implements.
-/// * (Zero or more) Flags wrapped in curly braces. Like `{ a = true, b = false }`
+/// * (Zero or more) Flags. Like `a = true, b = false`
///
/// # Flags
/// - `no_doc_hidden` - Don't hide the impl of the [`Injectable`] trait from
diff --git a/src/async_di_container.rs b/src/async_di_container.rs
index 0e29e4c..7913c5a 100644
--- a/src/async_di_container.rs
+++ b/src/async_di_container.rs
@@ -14,7 +14,7 @@
//!
//! struct DatabaseService {}
//!
-//! #[injectable(IDatabaseService, { async = true })]
+//! #[injectable(IDatabaseService, async = true)]
//! impl DatabaseService
//! {
//! fn new() -> Self