From c48271aef7e6b0819c497f302127c161845a83d7 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 18 Mar 2023 17:14:42 +0100 Subject: refactor: rewrite the mock macro as a procedural macro --- macros/src/util.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 macros/src/util.rs (limited to 'macros/src/util.rs') diff --git a/macros/src/util.rs b/macros/src/util.rs new file mode 100644 index 0000000..363051f --- /dev/null +++ b/macros/src/util.rs @@ -0,0 +1,22 @@ +use syn::punctuated::Punctuated; +use syn::token::Paren; +use syn::TypeTuple; + +pub fn create_unit_type_tuple() -> TypeTuple +{ + TypeTuple { + paren_token: Paren::default(), + elems: Punctuated::new(), + } +} + +macro_rules! create_path { + ($($segment: ident)::+) => { + Path::new( + WithLeadingColons::No, + [$(PathSegment::new(format_ident!(stringify!($segment)), None))+], + ) + }; +} + +pub(crate) use create_path; -- cgit v1.2.3-18-g5258