1use std::{error::Error, fmt};
2
3#[derive(#[automatically_derived]
impl ::core::fmt::Debug for UnknownEncodingError {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field1_finish(f,
"UnknownEncodingError", "label", &&self.label)
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for UnknownEncodingError {
#[inline]
fn clone(&self) -> UnknownEncodingError {
UnknownEncodingError {
label: ::core::clone::Clone::clone(&self.label),
}
}
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for UnknownEncodingError {
#[inline]
fn eq(&self, other: &UnknownEncodingError) -> bool {
self.label == other.label
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for UnknownEncodingError {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<String>;
}
}Eq)]
5pub struct UnknownEncodingError {
6 label: String,
7}
8
9impl UnknownEncodingError {
10 pub fn new(label: impl Into<String>) -> Self {
12 Self {
13 label: label.into(),
14 }
15 }
16}
17
18impl fmt::Display for UnknownEncodingError {
19 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
20 f.write_fmt(format_args!("unknown encoding: {0}", self.label))write!(f, "unknown encoding: {}", self.label)
21 }
22}
23
24impl Error for UnknownEncodingError {}
25
26#[derive(#[automatically_derived]
impl ::core::fmt::Debug for EncodingConversionError {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"EncodingConversionError", "encoding", &self.encoding,
"operation", &&self.operation)
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for EncodingConversionError {
#[inline]
fn clone(&self) -> EncodingConversionError {
EncodingConversionError {
encoding: ::core::clone::Clone::clone(&self.encoding),
operation: ::core::clone::Clone::clone(&self.operation),
}
}
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for EncodingConversionError {
#[inline]
fn eq(&self, other: &EncodingConversionError) -> bool {
self.encoding == other.encoding && self.operation == other.operation
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for EncodingConversionError {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<String>;
let _: ::core::cmp::AssertParamIsEq<&'static str>;
}
}Eq)]
28pub struct EncodingConversionError {
29 encoding: String,
30 operation: &'static str,
31}
32
33impl EncodingConversionError {
34 pub(crate) fn new(encoding: impl Into<String>, operation: &'static str) -> Self {
35 Self {
36 encoding: encoding.into(),
37 operation,
38 }
39 }
40}
41
42impl fmt::Display for EncodingConversionError {
43 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
44 f.write_fmt(format_args!("failed to {0} with encoding {1}", self.operation,
self.encoding))write!(
45 f,
46 "failed to {} with encoding {}",
47 self.operation, self.encoding
48 )
49 }
50}
51
52impl Error for EncodingConversionError {}
53
54#[derive(#[automatically_derived]
impl ::core::fmt::Debug for NativeEncodingError {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field1_finish(f,
"NativeEncodingError", "message", &&self.message)
}
}Debug, #[automatically_derived]
impl ::core::clone::Clone for NativeEncodingError {
#[inline]
fn clone(&self) -> NativeEncodingError {
NativeEncodingError {
message: ::core::clone::Clone::clone(&self.message),
}
}
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for NativeEncodingError {
#[inline]
fn eq(&self, other: &NativeEncodingError) -> bool {
self.message == other.message
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for NativeEncodingError {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<String>;
}
}Eq)]
56pub struct NativeEncodingError {
57 message: String,
58}
59
60impl NativeEncodingError {
61 pub(crate) fn new(message: impl Into<String>) -> Self {
62 Self {
63 message: message.into(),
64 }
65 }
66}
67
68impl fmt::Display for NativeEncodingError {
69 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
70 f.write_str(&self.message)
71 }
72}
73
74impl Error for NativeEncodingError {}