(
&mut self,
mode: TypeMode,
name: &str,
cases: impl IntoIterator<Item = (String, Option<&'b Type>)>,
)
| 2232 | } |
| 2233 | |
| 2234 | fn print_rust_enum_debug<'b>( |
| 2235 | &mut self, |
| 2236 | mode: TypeMode, |
| 2237 | name: &str, |
| 2238 | cases: impl IntoIterator<Item = (String, Option<&'b Type>)>, |
| 2239 | ) where |
| 2240 | Self: Sized, |
| 2241 | { |
| 2242 | self.push_str("impl"); |
| 2243 | self.print_generics(mode.lifetime); |
| 2244 | self.push_str(" ::core::fmt::Debug for "); |
| 2245 | self.push_str(name); |
| 2246 | self.print_generics(mode.lifetime); |
| 2247 | self.push_str(" {\n"); |
| 2248 | self.push_str( |
| 2249 | "fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {\n", |
| 2250 | ); |
| 2251 | self.push_str("match self {\n"); |
| 2252 | for (case_name, payload) in cases { |
| 2253 | self.push_str(name); |
| 2254 | self.push_str("::"); |
| 2255 | self.push_str(&case_name); |
| 2256 | if payload.is_some() { |
| 2257 | self.push_str("(e)"); |
| 2258 | } |
| 2259 | self.push_str(" => {\n"); |
| 2260 | self.push_str(&format!("f.debug_tuple(\"{name}::{case_name}\")")); |
| 2261 | if payload.is_some() { |
| 2262 | self.push_str(".field(e)"); |
| 2263 | } |
| 2264 | self.push_str(".finish()\n"); |
| 2265 | self.push_str("}\n"); |
| 2266 | } |
| 2267 | self.push_str("}\n"); |
| 2268 | self.push_str("}\n"); |
| 2269 | self.push_str("}\n"); |
| 2270 | } |
| 2271 | |
| 2272 | fn print_typedef_option(&mut self, id: TypeId, payload: &Type, docs: &Docs) { |
| 2273 | for (name, mode) in self.modes_of(id) { |
no test coverage detected