Debian Codegraph @

src/error.rs

raw symbols SCIP
1 //! When serializing or deserializing CBOR goes wrong.
2 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/;
3 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/;
4 use serderust-analyzer cargo serde 1.0.144 crate/::derust-analyzer cargo serde 1.0.144 de/;
5 use serderust-analyzer cargo serde 1.0.144 crate/::serrust-analyzer cargo serde 1.0.144 ser/;
6 #[cfg(feature = "std")]
7 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/;
8 #[cfg(feature = "std")]
9 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/;
10
11 /// This type represents all possible errors that can occur when serializing or deserializing CBOR
12 /// data.
13 pub struct Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#(ErrorImplrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl#);
14
15 /// Alias for a `Result` with the error type `serde_cbor::Error`.
16 pub type Resultrust-analyzer cargo serde_cbor_2 0.13.0 error/Result#<T> = resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<T, Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#>;
17
18 /// Categorizes the cause of a `serde_cbor::Error`.
19 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
20 pub enum Categoryrust-analyzer cargo serde_cbor_2 0.13.0 error/Category# {
21 /// The error was caused by a failure to read or write bytes on an IO stream.
22 Iorust-analyzer cargo serde_cbor_2 0.13.0 error/Category#Io#,
23 /// The error was caused by input that was not syntactically valid CBOR.
24 Syntaxrust-analyzer cargo serde_cbor_2 0.13.0 error/Category#Syntax#,
25 /// The error was caused by input data that was semantically incorrect.
26 Datarust-analyzer cargo serde_cbor_2 0.13.0 error/Category#Data#,
27 /// The error was caused by prematurely reaching the end of the input data.
28 Eofrust-analyzer cargo serde_cbor_2 0.13.0 error/Category#Eof#,
29 }
30
31 impl Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error# {
32 /// The byte offset at which the error occurred.
33 pub fn offsetrust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error]offset().(&self) -> u64 {
34 self.0rust-analyzer cargo serde_cbor_2 0.13.0 error/Error#0..offsetrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl#offset.
35 }
36
37 pub(craterust-analyzer cargo serde_cbor_2 0.13.0 crate/) fn syntaxrust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error]syntax().(code: ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#, offset: u64) -> Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error# {
38 Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#(ErrorImplrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl# { coderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl#code., offsetrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl#offset. })
39 }
40
41 #[cfg(feature = "std")]
42 pub(craterust-analyzer cargo serde_cbor_2 0.13.0 crate/) fn iorust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error]io().(error: iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#) -> Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error# {
43 Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#(ErrorImplrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl# {
44 coderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl#code.: ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::Iorust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#Io#(error),
45 offsetrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl#offset.: 0,
46 })
47 }
48
49 #[cfg(all(not(feature = "std"), feature = "unsealed_read_write"))]
50 /// Creates an error signalling that the underlying `Read` encountered an I/O error.
51 pub fn io() -> Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error# {
52 Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#(ErrorImplrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl# {
53 code: ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::Iorust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#Io#,
54 offset: 0,
55 })
56 }
57
58 #[cfg(feature = "unsealed_read_write")]
59 /// Creates an error signalling that the scratch buffer was too small to fit the data.
60 pub fn scratch_too_smallrust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error]scratch_too_small().(offset: u64) -> Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error# {
61 Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#(ErrorImplrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl# {
62 coderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl#code.: ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::ScratchTooSmallrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#ScratchTooSmall#,
63 offsetrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl#offset.,
64 })
65 }
66
67 #[cfg(not(feature = "unsealed_read_write"))]
68 pub(craterust-analyzer cargo serde_cbor_2 0.13.0 crate/) fn scratch_too_small(offset: u64) -> Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error# {
69 Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#(ErrorImplrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl# {
70 code: ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::ScratchTooSmallrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#ScratchTooSmall#,
71 offset,
72 })
73 }
74
75 #[cfg(feature = "unsealed_read_write")]
76 /// Creates an error with a custom message.
77 ///
78 /// **Note**: When the "std" feature is disabled, the message will be discarded.
79 pub fn messagerust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error]message().<T: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#>(_msg: T) -> Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error# {
80 #[cfg(not(feature = "std"))]
81 {
82 Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#(ErrorImplrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl# {
83 code: ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::Messagerust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#Message#,
84 offset: 0,
85 })
86 }
87 #[cfg(feature = "std")]
88 {
89 Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#(ErrorImplrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl# {
90 coderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl#code.: ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::Messagerust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#Message#(_msg.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()),
91 offsetrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl#offset.: 0,
92 })
93 }
94 }
95
96 #[cfg(not(feature = "unsealed_read_write"))]
97 pub(craterust-analyzer cargo serde_cbor_2 0.13.0 crate/) fn message<T: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#>(_msg: T) -> Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error# {
98 #[cfg(not(feature = "std"))]
99 {
100 Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#(ErrorImplrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl# {
101 code: ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::Messagerust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#Message#,
102 offset: 0,
103 })
104 }
105 #[cfg(feature = "std")]
106 {
107 Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#(ErrorImplrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl# {
108 code: ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::Messagerust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#Message#(_msg.to_string()),
109 offset: 0,
110 })
111 }
112 }
113
114 #[cfg(feature = "unsealed_read_write")]
115 /// Creates an error signalling that the underlying read
116 /// encountered an end of input.
117 pub fn eofrust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error]eof().(offset: u64) -> Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error# {
118 Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#(ErrorImplrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl# {
119 coderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl#code.: ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::EofWhileParsingValuerust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#EofWhileParsingValue#,
120 offsetrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl#offset.,
121 })
122 }
123
124 /// Categorizes the cause of this error.
125 pub fn classifyrust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error]classify().(&self) -> Categoryrust-analyzer cargo serde_cbor_2 0.13.0 error/Category# {
126 match self.0rust-analyzer cargo serde_cbor_2 0.13.0 error/Error#0..coderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl#code. {
127 #[cfg(feature = "std")]
128 ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::Messagerust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#Message#(_) => Categoryrust-analyzer cargo serde_cbor_2 0.13.0 error/Category#::Datarust-analyzer cargo serde_cbor_2 0.13.0 error/Category#Data#,
129 #[cfg(not(feature = "std"))]
130 ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::Messagerust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#Message# => Categoryrust-analyzer cargo serde_cbor_2 0.13.0 error/Category#::Datarust-analyzer cargo serde_cbor_2 0.13.0 error/Category#Data#,
131 #[cfg(feature = "std")]
132 ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::Iorust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#Io#(_) => Categoryrust-analyzer cargo serde_cbor_2 0.13.0 error/Category#::Iorust-analyzer cargo serde_cbor_2 0.13.0 error/Category#Io#,
133 #[cfg(not(feature = "std"))]
134 ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::Iorust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#Io# => Categoryrust-analyzer cargo serde_cbor_2 0.13.0 error/Category#::Iorust-analyzer cargo serde_cbor_2 0.13.0 error/Category#Io#,
135 ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::ScratchTooSmallrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#ScratchTooSmall# => Categoryrust-analyzer cargo serde_cbor_2 0.13.0 error/Category#::Iorust-analyzer cargo serde_cbor_2 0.13.0 error/Category#Io#,
136 ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::EofWhileParsingValuerust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#EofWhileParsingValue#
137 | ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::EofWhileParsingArrayrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#EofWhileParsingArray#
138 | ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::EofWhileParsingMaprust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#EofWhileParsingMap# => Categoryrust-analyzer cargo serde_cbor_2 0.13.0 error/Category#::Eofrust-analyzer cargo serde_cbor_2 0.13.0 error/Category#Eof#,
139 ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::LengthOutOfRangerust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#LengthOutOfRange#
140 | ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::InvalidUtf8rust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#InvalidUtf8#
141 | ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::UnassignedCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#UnassignedCode#
142 | ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::UnexpectedCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#UnexpectedCode#
143 | ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::TrailingDatarust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#TrailingData#
144 | ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::ArrayTooShortrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#ArrayTooShort#
145 | ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::ArrayTooLongrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#ArrayTooLong#
146 | ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::RecursionLimitExceededrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#RecursionLimitExceeded#
147 | ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::WrongEnumFormatrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#WrongEnumFormat#
148 | ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::WrongStructFormatrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#WrongStructFormat# => Categoryrust-analyzer cargo serde_cbor_2 0.13.0 error/Category#::Syntaxrust-analyzer cargo serde_cbor_2 0.13.0 error/Category#Syntax#,
149 }
150 }
151
152 /// Returns true if this error was caused by a failure to read or write bytes on an IO stream.
153 pub fn is_iorust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error]is_io().(&self) -> bool {
154 matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(self.classifyrust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error]classify().(), Categoryrust-analyzer cargo serde_cbor_2 0.13.0 error/Category#::Iorust-analyzer cargo serde_cbor_2 0.13.0 error/Category#Io#)
155 }
156
157 /// Returns true if this error was caused by input that was not syntactically valid CBOR.
158 pub fn is_syntaxrust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error]is_syntax().(&self) -> bool {
159 matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(self.classifyrust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error]classify().(), Categoryrust-analyzer cargo serde_cbor_2 0.13.0 error/Category#::Syntaxrust-analyzer cargo serde_cbor_2 0.13.0 error/Category#Syntax#)
160 }
161
162 /// Returns true if this error was caused by data that was semantically incorrect.
163 pub fn is_datarust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error]is_data().(&self) -> bool {
164 matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(self.classifyrust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error]classify().(), Categoryrust-analyzer cargo serde_cbor_2 0.13.0 error/Category#::Datarust-analyzer cargo serde_cbor_2 0.13.0 error/Category#Data#)
165 }
166
167 /// Returns true if this error was caused by prematurely reaching the end of the input data.
168 pub fn is_eofrust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error]is_eof().(&self) -> bool {
169 matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(self.classifyrust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error]classify().(), Categoryrust-analyzer cargo serde_cbor_2 0.13.0 error/Category#::Eofrust-analyzer cargo serde_cbor_2 0.13.0 error/Category#Eof#)
170 }
171
172 /// Returns true if this error was caused by the scratch buffer being too small.
173 ///
174 /// Note this being `true` implies that `is_io()` is also `true`.
175 pub fn is_scratch_too_smallrust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error]is_scratch_too_small().(&self) -> bool {
176 matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(self.0rust-analyzer cargo serde_cbor_2 0.13.0 error/Error#0..coderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl#code., ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::ScratchTooSmallrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#ScratchTooSmall#)
177 }
178 }
179
180 #[cfg(feature = "std")]
181 impl errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# for Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error# {
182 fn sourcerust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error][Error]source().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&(dyn errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + 'static)> {
183 match self.0rust-analyzer cargo serde_cbor_2 0.13.0 error/Error#0..coderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl#code. {
184 ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::Iorust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#Io#(ref err) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(err),
185 _ => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
186 }
187 }
188 }
189
190 impl fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error# {
191 fn fmtrust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
192 if self.0rust-analyzer cargo serde_cbor_2 0.13.0 error/Error#0..offsetrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl#offset. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialEq<Self>`]eq().0 {
193 fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[ErrorCode][Display]fmt().(&self.0rust-analyzer cargo serde_cbor_2 0.13.0 error/Error#0..coderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl#code., f)
194 } else {
195 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{} at offset {}", self.0rust-analyzer cargo serde_cbor_2 0.13.0 error/Error#0..coderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl#code., self.0rust-analyzer cargo serde_cbor_2 0.13.0 error/Error#0..offsetrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl#offset.)
196 }
197 }
198 }
199
200 impl fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error# {
201 fn fmtrust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error][Debug]fmt().(&self, fmt: &mut fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
202 fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#::fmtrust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[ErrorImpl][Debug]fmt().(&self.0rust-analyzer cargo serde_cbor_2 0.13.0 error/Error#0., fmt)
203 }
204 }
205
206 impl derust-analyzer cargo serde 1.0.144 de/::Errorrust-analyzer cargo serde 1.0.144 de/Error# for Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error# {
207 fn customrust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error][Error]custom().<T: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#>(msg: T) -> Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error# {
208 Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#::messagerust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error]message().(msg)
209 }
210
211 fn invalid_typerust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error][Error]invalid_type().(unexp: derust-analyzer cargo serde 1.0.144 de/::Unexpectedrust-analyzer cargo serde 1.0.144 de/Unexpected#<'_>, exp: &dyn derust-analyzer cargo serde 1.0.144 de/::Expectedrust-analyzer cargo serde 1.0.144 de/Expected#) -> Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error# {
212 if let derust-analyzer cargo serde 1.0.144 de/::Unexpectedrust-analyzer cargo serde 1.0.144 de/Unexpected#::Unitrust-analyzer cargo serde 1.0.144 de/Unexpected#Unit# = unexp {
213 Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#::customrust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error][Error]custom().(format_argsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/format_args!!("invalid type: null, expected {exp}"))
214 } else {
215 Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#::customrust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error][Error]custom().(format_argsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/format_args!!("invalid type: {unexp}, expected {exp}"))
216 }
217 }
218 }
219
220 impl serrust-analyzer cargo serde 1.0.144 ser/::Errorrust-analyzer cargo serde 1.0.144 ser/Error# for Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error# {
221 fn customrust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error][Error]custom().<T: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#>(msg: T) -> Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error# {
222 Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#::messagerust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error]message().(msg)
223 }
224 }
225
226 #[cfg(feature = "std")]
227 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#> for Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error# {
228 fn fromrust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error][`From<io::Error>`]from().(e: iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#) -> Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error# {
229 Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#::iorust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[Error]io().(e)
230 }
231 }
232
233 #[cfg(not(feature = "std"))]
234 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Error#> for Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error# {
235 fn from(_: corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Error#) -> Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error# {
236 Errorrust-analyzer cargo serde_cbor_2 0.13.0 error/Error#(ErrorImplrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl# {
237 code: ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::Messagerust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#Message#,
238 offset: 0,
239 })
240 }
241 }
242
243 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
244 struct ErrorImplrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl# {
245 coderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl#code.: ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#,
246 offsetrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorImpl#offset.: u64,
247 }
248
249 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
250 pub(craterust-analyzer cargo serde_cbor_2 0.13.0 crate/) enum ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode# {
251 #[cfg(feature = "std")]
252 Messagerust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#Message#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#),
253 #[cfg(not(feature = "std"))]
254 Message,
255 #[cfg(feature = "std")]
256 Iorust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#Io#(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#),
257 #[allow(unused)]
258 #[cfg(not(feature = "std"))]
259 Io,
260 ScratchTooSmallrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#ScratchTooSmall#,
261 EofWhileParsingValuerust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#EofWhileParsingValue#,
262 EofWhileParsingArrayrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#EofWhileParsingArray#,
263 EofWhileParsingMaprust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#EofWhileParsingMap#,
264 LengthOutOfRangerust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#LengthOutOfRange#,
265 InvalidUtf8rust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#InvalidUtf8#,
266 UnassignedCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#UnassignedCode#,
267 UnexpectedCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#UnexpectedCode#,
268 TrailingDatarust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#TrailingData#,
269 ArrayTooShortrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#ArrayTooShort#,
270 ArrayTooLongrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#ArrayTooLong#,
271 RecursionLimitExceededrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#RecursionLimitExceeded#,
272 WrongEnumFormatrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#WrongEnumFormat#,
273 WrongStructFormatrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#WrongStructFormat#,
274 }
275
276 impl fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode# {
277 fn fmtrust-analyzer cargo serde_cbor_2 0.13.0 error/impl#[ErrorCode][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
278 match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self {
279 #[cfg(feature = "std")]
280 ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::Messagerust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#Message#(ref msg) => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().(msg),
281 #[cfg(not(feature = "std"))]
282 ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::Messagerust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#Message# => f.write_str("Unknown error"),
283 #[cfg(feature = "std")]
284 ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::Iorust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#Io#(ref err) => fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error][Display]fmt().(err, f),
285 #[cfg(not(feature = "std"))]
286 ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::Iorust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#Io# => f.write_str("Unknown I/O error"),
287 ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::ScratchTooSmallrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#ScratchTooSmall# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("Scratch buffer too small"),
288 ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::EofWhileParsingValuerust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#EofWhileParsingValue# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("EOF while parsing a value"),
289 ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::EofWhileParsingArrayrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#EofWhileParsingArray# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("EOF while parsing an array"),
290 ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::EofWhileParsingMaprust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#EofWhileParsingMap# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("EOF while parsing a map"),
291 ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::LengthOutOfRangerust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#LengthOutOfRange# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("length out of range"),
292 ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::InvalidUtf8rust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#InvalidUtf8# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("invalid UTF-8"),
293 ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::UnassignedCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#UnassignedCode# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("unassigned type"),
294 ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::UnexpectedCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#UnexpectedCode# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("unexpected code"),
295 ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::TrailingDatarust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#TrailingData# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("trailing data"),
296 ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::ArrayTooShortrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#ArrayTooShort# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("array too short"),
297 ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::ArrayTooLongrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#ArrayTooLong# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("array too long"),
298 ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::RecursionLimitExceededrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#RecursionLimitExceeded# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("recursion limit exceeded"),
299 ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::WrongEnumFormatrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#WrongEnumFormat# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("wrong enum format"),
300 ErrorCoderust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#::WrongStructFormatrust-analyzer cargo serde_cbor_2 0.13.0 error/ErrorCode#WrongStructFormat# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("wrong struct format"),
301 }
302 }
303 }