(
&mut self,
id: TypeId,
mode: TypeMode,
name: &str,
cases: impl IntoIterator<Item = (String, Option<&'b Type>)>,
)
| 2146 | } |
| 2147 | |
| 2148 | fn print_rust_enum_debug<'b>( |
| 2149 | &mut self, |
| 2150 | id: TypeId, |
| 2151 | mode: TypeMode, |
| 2152 | name: &str, |
| 2153 | cases: impl IntoIterator<Item = (String, Option<&'b Type>)>, |
| 2154 | ) where |
| 2155 | Self: Sized, |
| 2156 | { |
| 2157 | let info = self.info(id); |
| 2158 | let lt = self.lifetime_for(&info, mode); |
| 2159 | self.push_str("impl"); |
| 2160 | self.print_generics(lt); |
| 2161 | self.push_str(" core::fmt::Debug for "); |
| 2162 | self.push_str(name); |
| 2163 | self.print_generics(lt); |
| 2164 | self.push_str(" {\n"); |
| 2165 | self.push_str("fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {\n"); |
| 2166 | self.push_str("match self {\n"); |
| 2167 | for (case_name, payload) in cases { |
| 2168 | self.push_str(name); |
| 2169 | self.push_str("::"); |
| 2170 | self.push_str(&case_name); |
| 2171 | if payload.is_some() { |
| 2172 | self.push_str("(e)"); |
| 2173 | } |
| 2174 | self.push_str(" => {\n"); |
| 2175 | self.push_str(&format!("f.debug_tuple(\"{name}::{case_name}\")")); |
| 2176 | if payload.is_some() { |
| 2177 | self.push_str(".field(e)"); |
| 2178 | } |
| 2179 | self.push_str(".finish()\n"); |
| 2180 | self.push_str("}\n"); |
| 2181 | } |
| 2182 | self.push_str("}\n"); |
| 2183 | self.push_str("}\n"); |
| 2184 | self.push_str("}\n"); |
| 2185 | } |
| 2186 | |
| 2187 | fn type_result(&mut self, id: TypeId, _name: &str, result: &Result_, docs: &Docs) { |
| 2188 | let info = self.info(id); |
no test coverage detected