|
|
|
@ -54,10 +54,6 @@ pub struct Error(Box<ErrorKind>, bool);
|
|
|
|
|
|
|
|
|
|
impl Error
|
|
|
|
|
{
|
|
|
|
|
#[inline(always)] fn into_mode(self, encode: bool) -> Self
|
|
|
|
|
{
|
|
|
|
|
Self(self.0, encode)
|
|
|
|
|
}
|
|
|
|
|
/// An encode error
|
|
|
|
|
#[inline] pub fn encode(kind: impl Into<ErrorKind>) -> Self
|
|
|
|
|
{
|
|
|
|
@ -75,6 +71,12 @@ impl Error
|
|
|
|
|
&self.0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Consume into the kind of error, which contains the original error object from the conversion (if there is one)
|
|
|
|
|
#[inline] pub fn into_inner(self) -> ErrorKind
|
|
|
|
|
{
|
|
|
|
|
*self.0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Is an encode error?
|
|
|
|
|
#[inline] pub fn is_encode(&self) -> bool
|
|
|
|
|
{
|
|
|
|
@ -105,7 +107,7 @@ impl fmt::Display for Error
|
|
|
|
|
{
|
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
|
|
|
|
|
{
|
|
|
|
|
write!(f, "formatting error: ")?;
|
|
|
|
|
write!(f, "formatting error in ")?;
|
|
|
|
|
if self.1 {
|
|
|
|
|
write!(f, "encode")
|
|
|
|
|
} else {
|
|
|
|
|