-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
2 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,6 @@ | ||
use proc_macro2::TokenStream; | ||
use quote::quote; | ||
use syn::DeriveInput; | ||
|
||
#[no_mangle] | ||
pub extern "C" fn demo(input: TokenStream) -> TokenStream { | ||
let input: DeriveInput = match syn::parse2(input) { | ||
Ok(input) => input, | ||
Err(err) => return err.to_compile_error(), | ||
}; | ||
|
||
let ident = input.ident; | ||
let message = format!("Hello from WASM! My name is {}.", ident); | ||
|
||
quote! { | ||
impl #ident { | ||
pub const MESSAGE: &'static str = #message; | ||
} | ||
} | ||
pub extern "C" fn demo(_input: TokenStream) -> TokenStream { | ||
panic!("oh no!"); | ||
} |