/// Expression that can be used inside of `invoke` expressions for core wasm /// functions. #[derive(Debug)] #[allow(missing_docs)] pubenum WastArgCore<'a> {
I32(i32),
I64(i64),
F32(F32),
F64(F64),
V128(V128Const),
RefNull(HeapType<'a>),
RefExtern(u32),
RefHost(u32),
}
/// Expressions that can be used inside of `assert_return` to validate the /// return value of a core wasm function. #[derive(Debug)] #[allow(missing_docs)] pubenum WastRetCore<'a> {
I32(i32),
I64(i64),
F32(NanPattern<F32>),
F64(NanPattern<F64>),
V128(V128Pattern),
/// A null reference is expected, optionally with a specified type.
RefNull(Option<HeapType<'a>>), /// A non-null externref is expected which should contain the specified /// value.
RefExtern(Option<u32>), /// A non-null anyref is expected which should contain the specified host value.
RefHost(u32), /// A non-null funcref is expected.
RefFunc(Option<Index<'a>>), /// A non-null anyref is expected.
RefAny, /// A non-null eqref is expected.
RefEq, /// A non-null arrayref is expected.
RefArray, /// A non-null structref is expected.
RefStruct, /// A non-null i31ref is expected.
RefI31, /// A non-null, shared i31ref is expected.
RefI31Shared,
/// Either a NaN pattern (`nan:canonical`, `nan:arithmetic`) or a value of type `T`. #[derive(Copy, Clone, Debug, PartialEq)] #[allow(missing_docs)] pubenum NanPattern<T> {
CanonicalNan,
ArithmeticNan,
Value(T),
}
impl<'a, T> Parse<'a> for NanPattern<T> where
T: Parse<'a>,
{ fn parse(parser: Parser<'a>) -> Result<Self> { if parser.peek::<kw::nan_canonical>()? {
parser.parse::<kw::nan_canonical>()?;
Ok(NanPattern::CanonicalNan)
} elseif parser.peek::<kw::nan_arithmetic>()? {
parser.parse::<kw::nan_arithmetic>()?;
Ok(NanPattern::ArithmeticNan)
} else { let val = parser.parse()?;
Ok(NanPattern::Value(val))
}
}
}
/// A version of `V128Const` that allows `NanPattern`s. /// /// This implementation is necessary because only float types can include NaN patterns; otherwise /// it is largely similar to the implementation of `V128Const`. #[derive(Clone, Debug)] #[allow(missing_docs)] pubenum V128Pattern {
I8x16([i8; 16]),
I16x8([i16; 8]),
I32x4([i32; 4]),
I64x2([i64; 2]),
F32x4([NanPattern<F32>; 4]),
F64x2([NanPattern<F64>; 2]),
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.