1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#[cfg(feature = "std")]
use std::fmt::{self, Display, Formatter};

#[cfg(feature = "std")]
use std::error::Error;

#[derive(Debug)]
pub struct Utf8Error;

#[cfg(feature = "std")]
impl Display for Utf8Error {
    #[inline]
    fn fmt(&self, f: &mut Formatter) -> fmt::Result {
        f.write_str("incorrect UTF-8 data")
    }
}

#[cfg(feature = "std")]
impl Error for Utf8Error {}