[−][src]Struct watt_non_static_runtime::WasmMacro
An instantiation of a WebAssembly module used to invoke procedural macro methods on the wasm module.
Examples
static MACRO: WasmMacro = WasmMacro::new(WASM); static WASM: &[u8] = include_bytes!("my_macros.wasm");
Implementations
impl<'bytecode> WasmMacro<'bytecode>
[src]
pub const fn new(wasm: &'bytecode [u8]) -> Self
[src]
Creates a new WasmMacro
from the statically included blob of wasm bytes.
Examples
static MACRO: WasmMacro = WasmMacro::new(WASM); static WASM: &[u8] = include_bytes!("my_macros.wasm");
pub fn proc_macro(&self, fun: &str, input: TokenStream) -> TokenStream
[src]
A #[proc_macro] implemented in wasm!
Canonical macro implementation:
use proc_macro2::TokenStream; #[no_mangle] pub extern "C" fn the_macro(input: TokenStream) -> TokenStream { ... }
Canonical entry point:
use proc_macro::TokenStream; use watt::WasmMacro; static MACRO: WasmMacro = WasmMacro::new(WASM); static WASM: &[u8] = include_bytes!("my_macros.wasm"); #[proc_macro] pub fn the_macro(input: TokenStream) -> TokenStream { MACRO.proc_macro("the_macro", input) }
pub fn proc_macro_derive(&self, fun: &str, input: TokenStream) -> TokenStream
[src]
A #[proc_macro_derive] implemented in wasm!
Canonical macro implementation:
use proc_macro2::TokenStream; #[no_mangle] pub extern "C" fn the_macro(input: TokenStream) -> TokenStream { ... }
Canonical entry point:
use proc_macro::TokenStream; use watt::WasmMacro; static MACRO: WasmMacro = WasmMacro::new(WASM); static WASM: &[u8] = include_bytes!("my_macros.wasm"); #[proc_macro_derive(MyDerive)] pub fn the_macro(input: TokenStream) -> TokenStream { MACRO.proc_macro_derive("the_macro", input) }
pub fn proc_macro_attribute(
&self,
fun: &str,
args: TokenStream,
input: TokenStream
) -> TokenStream
[src]
&self,
fun: &str,
args: TokenStream,
input: TokenStream
) -> TokenStream
A #[proc_macro_attribute] implemented in wasm!
Canonical macro implementation:
use proc_macro2::TokenStream; #[no_mangle] pub extern "C" fn the_macro(args: TokenStream, input: TokenStream) -> TokenStream { ... }
Canonical entry point:
use proc_macro::TokenStream; use watt::WasmMacro; static MACRO: WasmMacro = WasmMacro::new(WASM); static WASM: &[u8] = include_bytes!("my_macros.wasm"); #[proc_macro_attribute] pub fn the_macro(args: TokenStream, input: TokenStream) -> TokenStream { MACRO.proc_macro_attribute("the_macro", args, input) }
Auto Trait Implementations
impl<'bytecode> RefUnwindSafe for WasmMacro<'bytecode>
impl<'bytecode> Send for WasmMacro<'bytecode>
impl<'bytecode> Sync for WasmMacro<'bytecode>
impl<'bytecode> Unpin for WasmMacro<'bytecode>
impl<'bytecode> UnwindSafe for WasmMacro<'bytecode>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,