Macro for_each_visit_simd_operator

Source
macro_rules! for_each_visit_simd_operator {
    ($m:ident) => { ... };
}
Available on crate feature simd only.
Expand description

Used to implement the VisitSimdOperator trait.

The list of specializable Wasm proposals is as follows:

For more information about the structure and use of this macro please refer to the documentation of the for_each_operator macro.

pub struct VisitAndDoNothing;

impl<'a> wasmparser::VisitOperator<'a> for VisitAndDoNothing {
    type Output = ();

    // implement all the visit methods ..
}

macro_rules! define_visit_simd_operator {
    // The outer layer of repetition represents how all operators are
    // provided to the macro at the same time.
    //
    // The `$proposal` identifier is either `@simd` or `@relaxed_simd`.
    //
    // The shape of this macro is identical to [`for_each_visit_operator`].
    // Please refer to its documentation if you want to learn more.
    ($( @$proposal:ident $op:ident $({ $($arg:ident: $argty:ty),* })? => $visit:ident ($($ann:tt)*))*) => {
        $(
            fn $visit(&mut self $($(,$arg: $argty)*)?) {
                // do nothing for this example
            }
        )*
    }
}

impl<'a> wasmparser::VisitSimdOperator<'a> for VisitAndDoNothing {
    wasmparser::for_each_visit_simd_operator!(define_visit_simd_operator);
}