Debian Codegraph @

third_party/rust/wast/src/component_disabled.rs

raw
1 //! Disabled support for the component model.
2
3 use crate::parser::{Parse, Parser, Result};
4 use crate::token::{Id, Span};
5
6 #[derive(Debug)]
7 enum Uninhabited {}
8
9 /// Empty definition of a component that cannot be created.
10 #[derive(Debug)]
11 pub struct Component<'a> {
12 /// Where this `component` was defined
13 pub span: Span,
14 /// An optional identifier this component is known by
15 pub id: Option<Id<'a>>,
16
17 x: Uninhabited,
18 }
19
20 impl Component<'_> {
21 pub(crate) fn validate(&self, _parser: Parser<'_>) -> Result<()> {
22 match self.x {}
23 }
24 }
25
26 impl<'a> Parse<'a> for Component<'a> {
27 fn parse(parser: Parser<'a>) -> Result<Self> {
28 Err(parser.error("support for parsing components disabled at compile time"))
29 }
30 }