/// A `*.wat` file parser, or a parser for one parenthesized module. /// /// This is the top-level type which you'll frequently parse when working with /// this crate. A `*.wat` file is either one `module` s-expression or a sequence /// of s-expressions that are module fields. #[derive(Debug)] #[allow(missing_docs)] pubenum Wat<'a> {
Module(Module<'a>),
Component(Component<'a>),
}
/// Encodes this `Wat` to binary form. This calls either [`Module::encode`] /// or [`Component::encode`]. pubfn encode(&mutself) -> std::result::Result<Vec<u8>, crate::Error> { crate::core::EncodeOptions::default().encode_wat(self)
}
/// Returns the defining span of this file. pubfn span(&self) -> Span { matchself {
Wat::Module(m) => m.span,
Wat::Component(c) => c.span,
}
}
}
impl<'a> Parse<'a> for Wat<'a> { fn parse(parser: Parser<'a>) -> Result<Self> { if !parser.has_meaningful_tokens() { return Err(parser.error("expected at least one module field"));
}
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.