Emits the atom-conditional match arm used in must-occur loops.
(&self)
| 132 | |
| 133 | /// Emits the atom-conditional match arm used in must-occur loops. |
| 134 | fn atom_match_arm(&self) -> TokenStream { |
| 135 | let atom = self.atom.as_ref().expect("atom_match_arm called without atom"); |
| 136 | let atom_path = atom.path(); |
| 137 | let atom_set = atom.first_segment(); |
| 138 | let var = &self.var; |
| 139 | let inner_ty = self.ty.unpack_option(); |
| 140 | quote! { |
| 141 | if #var.is_none() && p.peek::<#inner_ty>() && p.to_atom::<#atom_set>(c) == #atom_path { |
| 142 | #var = Some(p.parse::<#inner_ty>()?); |
| 143 | continue; |
| 144 | } |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | /// Emits a simple parse-if-peek for a single atom field. |
| 149 | fn atom_parse_if_peek(&self) -> TokenStream { |
no test coverage detected