|
1 | | -use serde::{de, ser}; |
2 | 1 | use std::{error::Error as StdError, fmt, io, str::Utf8Error, string::FromUtf8Error}; |
3 | 2 |
|
| 3 | +use serde::{de, ser}; |
| 4 | + |
4 | 5 | /// This type represents all possible errors that can occur when |
5 | 6 | /// serializing or deserializing RON data. |
6 | 7 | #[derive(Clone, Debug, PartialEq, Eq)] |
@@ -276,15 +277,9 @@ impl de::Error for Error { |
276 | 277 | Float(n) => write!(f, "the floating point number `{}`", n), |
277 | 278 | Char(c) => write!(f, "the UTF-8 character `{}`", c), |
278 | 279 | Str(s) => write!(f, "the string {:?}", s), |
279 | | - Bytes(b) => { |
280 | | - f.write_str("the bytes b\"")?; |
281 | | - |
282 | | - for b in b { |
283 | | - write!(f, "\\x{:02x}", b)?; |
284 | | - } |
285 | | - |
286 | | - f.write_str("\"") |
287 | | - } |
| 280 | + Bytes(b) => write!(f, "the bytes \"{}\"", { |
| 281 | + base64::display::Base64Display::with_config(b, base64::STANDARD) |
| 282 | + }), |
288 | 283 | Unit => write!(f, "a unit value"), |
289 | 284 | Option => write!(f, "an optional value"), |
290 | 285 | NewtypeStruct => write!(f, "a newtype struct"), |
|
0 commit comments