(input: ParseStream<'_>)
| 76 | |
| 77 | impl Parse for Config { |
| 78 | fn parse(input: ParseStream<'_>) -> Result<Self> { |
| 79 | let call_site = Span::call_site(); |
| 80 | let mut opts = Opts::default(); |
| 81 | let mut world = None; |
| 82 | let mut inline = None; |
| 83 | let mut paths = Vec::new(); |
| 84 | let mut imports_configured = false; |
| 85 | let mut exports_configured = false; |
| 86 | let mut include_generated_code_from_file = false; |
| 87 | |
| 88 | if input.peek(token::Brace) { |
| 89 | let content; |
| 90 | syn::braced!(content in input); |
| 91 | let fields = Punctuated::<Opt, Token![,]>::parse_terminated(&content)?; |
| 92 | for field in fields.into_pairs() { |
| 93 | match field.into_value() { |
| 94 | Opt::Path(p) => { |
| 95 | paths.extend(p.into_iter().map(|p| p.value())); |
| 96 | } |
| 97 | Opt::World(s) => { |
| 98 | if world.is_some() { |
| 99 | return Err(Error::new(s.span(), "cannot specify second world")); |
| 100 | } |
| 101 | world = Some(s.value()); |
| 102 | } |
| 103 | Opt::Inline(s) => { |
| 104 | if inline.is_some() { |
| 105 | return Err(Error::new(s.span(), "cannot specify second source")); |
| 106 | } |
| 107 | inline = Some(s.value()); |
| 108 | } |
| 109 | Opt::Debug(val) => opts.debug = val, |
| 110 | Opt::TrappableErrorType(val) => opts.trappable_error_type = val, |
| 111 | Opt::Ownership(val) => opts.ownership = val, |
| 112 | Opt::Interfaces(s) => { |
| 113 | if inline.is_some() { |
| 114 | return Err(Error::new(s.span(), "cannot specify a second source")); |
| 115 | } |
| 116 | inline = Some(format!( |
| 117 | " |
| 118 | package wasmtime:component-macro-synthesized; |
| 119 | |
| 120 | world interfaces {{ |
| 121 | {} |
| 122 | }} |
| 123 | ", |
| 124 | s.value() |
| 125 | )); |
| 126 | |
| 127 | if world.is_some() { |
| 128 | return Err(Error::new( |
| 129 | s.span(), |
| 130 | "cannot specify a world with `interfaces`", |
| 131 | )); |
| 132 | } |
| 133 | world = Some("wasmtime:component-macro-synthesized/interfaces".to_string()); |
| 134 | |
| 135 | opts.only_interfaces = true; |
nothing calls this directly
no test coverage detected