Skip to content

Commit

Permalink
Expose macro_export in guest-rust-macro (#431)
Browse files Browse the repository at this point in the history
* Expose MacroExport option

* Add MacroExport to Parse func
  • Loading branch information
AmitPr committed Nov 15, 2022
1 parent bae7474 commit 717ab1e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/guest-rust-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ mod kw {
syn::custom_keyword!(unchecked);
syn::custom_keyword!(no_std);
syn::custom_keyword!(raw_strings);
syn::custom_keyword!(macro_export);
syn::custom_keyword!(macro_call_prefix);
syn::custom_keyword!(export_macro_name);
syn::custom_keyword!(skip);
Expand All @@ -24,6 +25,7 @@ enum Opt {
Unchecked,
NoStd,
RawStrings,
MacroExport,
MacroCallPrefix(LitStr),
ExportMacroName(LitStr),
Skip(Vec<LitStr>),
Expand All @@ -41,6 +43,9 @@ impl Parse for Opt {
} else if l.peek(kw::raw_strings) {
input.parse::<kw::raw_strings>()?;
Ok(Opt::RawStrings)
} else if l.peek(kw::macro_export) {
input.parse::<kw::macro_export>()?;
Ok(Opt::MacroExport)
} else if l.peek(kw::macro_call_prefix) {
input.parse::<kw::macro_call_prefix>()?;
input.parse::<Token![:]>()?;
Expand Down Expand Up @@ -68,6 +73,7 @@ impl wit_bindgen_rust_macro_shared::Configure<Opts> for Opt {
Opt::Unchecked => opts.unchecked = true,
Opt::NoStd => opts.no_std = true,
Opt::RawStrings => opts.raw_strings = true,
Opt::MacroExport => opts.macro_export = true,
Opt::MacroCallPrefix(prefix) => opts.macro_call_prefix = Some(prefix.value()),
Opt::ExportMacroName(name) => opts.export_macro_name = Some(name.value()),
Opt::Skip(list) => opts.skip.extend(list.iter().map(|i| i.value())),
Expand Down

0 comments on commit 717ab1e

Please sign in to comment.