Skip to content

Commit

Permalink
Add macros to generate protocols
Browse files Browse the repository at this point in the history
  • Loading branch information
morr0ne committed Sep 26, 2024
1 parent d0f19ef commit e6e6f94
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ proc-macro = true
[dependencies]
quote = "1.0.36"
syn = { version = "2.0.70", features = ["full"] }
waynest-gen = { version = "0.0.1", path = "../gen", optional = true }

[features]
gen = ["dep:waynest-gen"]
18 changes: 18 additions & 0 deletions macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,21 @@ pub fn derive_dispatcher(input: TokenStream) -> TokenStream {
}
.into()
}

#[proc_macro]
#[cfg(feature = "gen")]
pub fn server_protocol(input: TokenStream) -> TokenStream {
use syn::LitStr;

let _xml = parse_macro_input!(input as LitStr);
quote! {}.into()
}

#[proc_macro]
#[cfg(feature = "gen")]
pub fn client_protocol(input: TokenStream) -> TokenStream {
use syn::LitStr;

let _xml = parse_macro_input!(input as LitStr);
quote! {}.into()
}

0 comments on commit e6e6f94

Please sign in to comment.