/// An `import` statement and entry in a WebAssembly module. #[derive(Debug, Clone)] pubstruct Import<'a> { /// Where this `import` was defined pub span: Span, /// The module that this statement is importing from pub module: &'a str, /// The name of the field in the module this statement imports from. pub field: &'a str, /// The item that's being imported. pub item: ItemSig<'a>,
}
impl<'a> Parse<'a> for Import<'a> { fn parse(parser: Parser<'a>) -> Result<Self> { let span = parser.parse::<kw::import>()?.0; let module = parser.parse()?; let field = parser.parse()?; let item = parser.parens(|p| p.parse())?;
Ok(Import {
span,
module,
field,
item,
})
}
}
#[derive(Debug, Clone)] #[allow(missing_docs)] pubstruct ItemSig<'a> { /// Where this item is defined in the source. pub span: Span, /// An optional identifier used during name resolution to refer to this item /// from the rest of the module. pub id: Option<Id<'a>>, /// An optional name which, for functions, will be stored in the /// custom `name` section. pub name: Option<NameAnnotation<'a>>, /// What kind of item this is. pub kind: ItemKind<'a>,
}
/// A listing of a inline `(import "foo")` statement. /// /// Note that when parsing this type it is somewhat unconventional that it /// parses its own surrounding parentheses. This is typically an optional type, /// so it's so far been a bit nicer to have the optionality handled through /// `Peek` rather than `Option<T>`. #[derive(Debug, Copy, Clone)] #[allow(missing_docs)] pubstruct InlineImport<'a> { pub module: &'a str, pub field: &'a str,
}
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.