(&mut self, s: &str, flags: impl Into<AnyStringFlags>)
| 206 | } |
| 207 | |
| 208 | fn p_str_repr(&mut self, s: &str, flags: impl Into<AnyStringFlags>) { |
| 209 | let flags = flags.into(); |
| 210 | if flags.prefix().is_raw() { |
| 211 | write!(self.buffer, "{}", flags.display_contents(s)) |
| 212 | .expect("Writing to a String buffer should never fail"); |
| 213 | return; |
| 214 | } |
| 215 | self.p(flags.prefix().as_str()); |
| 216 | |
| 217 | let quote_style = self.mode.quote_style(flags); |
| 218 | let escape = UnicodeEscape::with_preferred_quote(s, quote_style); |
| 219 | if let Some(len) = escape.layout().len { |
| 220 | self.buffer.reserve(len); |
| 221 | } |
| 222 | escape |
| 223 | .str_repr(flags.triple_quotes()) |
| 224 | .write(&mut self.buffer) |
| 225 | .expect("Writing to a String buffer should never fail"); |
| 226 | } |
| 227 | |
| 228 | fn p_if(&mut self, cond: bool, s: &str) { |
| 229 | if cond { |
no test coverage detected