Get a display-friendly representation of the content. For binary content, returns a placeholder like `[binary data: 42 bytes]`.
(&self)
| 183 | /// |
| 184 | /// For binary content, returns a placeholder like `[binary data: 42 bytes]`. |
| 185 | pub fn display_content(&self) -> std::borrow::Cow<'a, str> { |
| 186 | if self.is_binary() { |
| 187 | std::borrow::Cow::Owned(format!("[binary data: {} bytes]", self.raw.len())) |
| 188 | } else { |
| 189 | std::borrow::Cow::Borrowed(self.content) |
| 190 | } |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | impl<'a> fmt::Display for DisplayLine<'a> { |