Debian Codegraph @

src/decoding/error.rs

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::{
2 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!,
3 strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::Utf8Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/error/Utf8Error#,
4 stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/::{FromUtf8Errorrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/FromUtf8Error#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, ToStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/ToString#},
5 };
6 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/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#, numrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/::ParseIntErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/error/ParseIntError#};
7
8 #[cfg(feature = "std")]
9 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#;
10
11 use thiserrorrust-analyzer cargo thiserror 2.0.16 crate/::Errorrust-analyzer cargo thiserror-impl 2.0.16 Error:;
12
13 use craterust-analyzer cargo bendy 0.6.1 crate/::state_trackerrust-analyzer cargo bendy 0.6.1 state_tracker/;
14
15 #[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:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)]
16 pub struct Errorrust-analyzer cargo bendy 0.6.1 decoding/error/Error# {
17 contextrust-analyzer cargo bendy 0.6.1 decoding/error/Error#context.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>,
18 kindrust-analyzer cargo bendy 0.6.1 decoding/error/Error#kind.: ErrorKindrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#,
19 }
20
21 impl 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/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for Errorrust-analyzer cargo bendy 0.6.1 decoding/error/Error# {
22 fn fmtrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error][Display]fmt().(&self, f: &mut 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/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> 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/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
23 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{}", self.kindrust-analyzer cargo bendy 0.6.1 decoding/error/Error#kind.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
24 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(c) = &self.contextrust-analyzer cargo bendy 0.6.1 decoding/error/Error#context. {
25 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "\nin context:\n\t{}", c)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
26 }
27 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
28 }
29 }
30
31 impl corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# for Errorrust-analyzer cargo bendy 0.6.1 decoding/error/Error# {
32 fn sourcerust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error][Error]source().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&(dyn corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + 'static)> {
33 self.kindrust-analyzer cargo bendy 0.6.1 decoding/error/Error#kind..sourcerust-analyzer cargo bendy 0.6.1 decoding/error/impl#[ErrorKind][Error]source().()
34 }
35 }
36
37 // An enumeration of potential errors that appear during bencode deserialization.
38 #[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:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Errorrust-analyzer cargo thiserror-impl 2.0.16 Error:)]
39 #[non_exhaustive]
40 pub enum ErrorKindrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind# {
41 /// Error that occurs if the serialized structure contains invalid semantics.
42 #[cfg(feature = "std")]
43 #[errorrust-analyzer cargo thiserror-impl 2.0.16 error:("malformed content discovered: {source}")]
44 MalformedContentrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#MalformedContent# {
45 #[source]
46 sourcerust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#MalformedContent#source.: Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<dyn 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/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync#>,
47 },
48
49 /// Error that occurs if the serialized structure contains invalid semantics.
50 #[cfg(not(feature = "std"))]
51 #[errorrust-analyzer cargo thiserror-impl 2.0.16 error:("malformed content discovered")]
52 MalformedContent,
53
54 /// Error that occurs if the serialized structure is incomplete.
55 #[errorrust-analyzer cargo thiserror-impl 2.0.16 error:("missing field: {field}")]
56 MissingFieldrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#MissingField# { fieldrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#MissingField#field.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# },
57
58 /// Error in the bencode structure (e.g. a missing field and seperator).
59 #[errorrust-analyzer cargo thiserror-impl 2.0.16 error:("bencode encoding corrupted ({source})")]
60 StructureErrorrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#StructureError# {
61 sourcerust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#StructureError#source.: state_trackerrust-analyzer cargo bendy 0.6.1 state_tracker/::StructureErrorrust-analyzer cargo bendy 0.6.1 state_tracker/structure_error/StructureError#,
62 },
63
64 /// Error that occurs if the serialized structure contains an unexpected field.
65 #[errorrust-analyzer cargo thiserror-impl 2.0.16 error:("unexpected field: {field}")]
66 UnexpectedFieldrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#UnexpectedField# { fieldrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#UnexpectedField#field.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# },
67
68 /// Error through an unexpected bencode token during deserialization.
69 #[errorrust-analyzer cargo thiserror-impl 2.0.16 error:("discovered {discovered} but expected {expected}")]
70 UnexpectedTokenrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#UnexpectedToken# {
71 expectedrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#UnexpectedToken#expected.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
72 discoveredrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#UnexpectedToken#discovered.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
73 },
74 }
75
76 pub trait ResultExtrust-analyzer cargo bendy 0.6.1 decoding/error/ResultExt# {
77 fn contextrust-analyzer cargo bendy 0.6.1 decoding/error/ResultExt#context().(self, context: impl Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#) -> Self;
78 }
79
80 impl Errorrust-analyzer cargo bendy 0.6.1 decoding/error/Error# {
81 pub fn contextrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error]context().(mut self, context: impl Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#) -> Selfrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error] {
82 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(current) = self.contextrust-analyzer cargo bendy 0.6.1 decoding/error/Error#context..as_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_mut().() {
83 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().current = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{current}\n\t{context}");
84 } else {
85 self.contextrust-analyzer cargo bendy 0.6.1 decoding/error/Error#context. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(context.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().());
86 }
87
88 self
89 }
90
91 /// Raised when there is a general error while deserializing a type.
92 /// The message should not be capitalized and should not end with a period.
93 #[cfg(feature = "std")]
94 pub fn malformed_contentrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error]malformed_content().<SourceT>(source: SourceT) -> Selfrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error]
95 where
96 SourceT: 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/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + 'static,
97 {
98 let error = Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T>`]new().(source);
99 ErrorKindrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#::MalformedContentrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#MalformedContent# { sourcerust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#MalformedContent#source.: error }.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()
100 }
101
102 /// Raised when there is a general error while deserializing a type.
103 /// The message should not be capitalized and should not end with a period.
104 #[cfg(not(feature = "std"))]
105 pub fn malformed_content<T>(_cause: T) -> Selfrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error] {
106 Selfrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error]::from(ErrorKindrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#::MalformedContentrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#MalformedContent#)
107 }
108
109 /// Returns a `Error::MissingField` which contains the name of the field.
110 pub fn missing_fieldrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error]missing_field().(field_name: impl Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#) -> Selfrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error] {
111 Errorrust-analyzer cargo bendy 0.6.1 decoding/error/Error#::fromrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error][`From<ErrorKind>`]from().(ErrorKindrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#::MissingFieldrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#MissingField# {
112 fieldrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#MissingField#field.: field_name.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
113 })
114 }
115
116 /// Returns a `Error::UnexpectedField` which contains the name of the field.
117 pub fn unexpected_fieldrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error]unexpected_field().(field_name: impl Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#) -> Selfrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error] {
118 Errorrust-analyzer cargo bendy 0.6.1 decoding/error/Error#::fromrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error][`From<ErrorKind>`]from().(ErrorKindrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#::UnexpectedFieldrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#UnexpectedField# {
119 fieldrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#UnexpectedField#field.: field_name.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
120 })
121 }
122
123 /// Returns a `Error::UnexpectedToken` which contains a custom error message.
124 pub fn unexpected_tokenrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error]unexpected_token().(expected: impl Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#, discovered: impl Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#) -> Selfrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error] {
125 Errorrust-analyzer cargo bendy 0.6.1 decoding/error/Error#::fromrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error][`From<ErrorKind>`]from().(ErrorKindrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#::UnexpectedTokenrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#UnexpectedToken# {
126 expectedrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#UnexpectedToken#expected.: expected.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
127 discoveredrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#UnexpectedToken#discovered.: discovered.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
128 })
129 }
130 }
131
132 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<ErrorKindrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#> for Errorrust-analyzer cargo bendy 0.6.1 decoding/error/Error# {
133 fn fromrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error][`From<ErrorKind>`]from().(kind: ErrorKindrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#) -> Selfrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error][`From<ErrorKind>`] {
134 Selfrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error][`From<ErrorKind>`] {
135 contextrust-analyzer cargo bendy 0.6.1 decoding/error/Error#context.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
136 kindrust-analyzer cargo bendy 0.6.1 decoding/error/Error#kind.,
137 }
138 }
139 }
140
141 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<state_trackerrust-analyzer cargo bendy 0.6.1 state_tracker/::StructureErrorrust-analyzer cargo bendy 0.6.1 state_tracker/structure_error/StructureError#> for Errorrust-analyzer cargo bendy 0.6.1 decoding/error/Error# {
142 fn fromrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error][`From<state_tracker::StructureError>`]from().(error: state_trackerrust-analyzer cargo bendy 0.6.1 state_tracker/::StructureErrorrust-analyzer cargo bendy 0.6.1 state_tracker/structure_error/StructureError#) -> Selfrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error][`From<state_tracker::StructureError>`] {
143 Selfrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error][`From<state_tracker::StructureError>`]::fromrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error][`From<ErrorKind>`]from().(ErrorKindrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#::StructureErrorrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#StructureError# { sourcerust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#StructureError#source.: error })
144 }
145 }
146
147 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<FromUtf8Errorrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/FromUtf8Error#> for Errorrust-analyzer cargo bendy 0.6.1 decoding/error/Error# {
148 fn fromrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error][`From<FromUtf8Error>`]from().(err: FromUtf8Errorrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/FromUtf8Error#) -> Selfrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error][`From<FromUtf8Error>`] {
149 Selfrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error][`From<FromUtf8Error>`]::malformed_contentrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error]malformed_content().(err)
150 }
151 }
152
153 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Utf8Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/error/Utf8Error#> for Errorrust-analyzer cargo bendy 0.6.1 decoding/error/Error# {
154 fn fromrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error][`From<Utf8Error>`]from().(err: Utf8Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/error/Utf8Error#) -> Selfrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error][`From<Utf8Error>`] {
155 Selfrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error][`From<Utf8Error>`]::malformed_contentrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error]malformed_content().(err)
156 }
157 }
158
159 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<ParseIntErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/error/ParseIntError#> for Errorrust-analyzer cargo bendy 0.6.1 decoding/error/Error# {
160 fn fromrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error][`From<ParseIntError>`]from().(err: ParseIntErrorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/error/ParseIntError#) -> Selfrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error][`From<ParseIntError>`] {
161 Selfrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error][`From<ParseIntError>`]::malformed_contentrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error]malformed_content().(err)
162 }
163 }
164
165 impl<T> ResultExtrust-analyzer cargo bendy 0.6.1 decoding/error/ResultExt# for Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<T, Errorrust-analyzer cargo bendy 0.6.1 decoding/error/Error#> {
166 fn contextrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[`Result<T, Error>`][ResultExt]context().(self, context: impl Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#) -> Selfrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[`Result<T, Error>`][ResultExt] {
167 self.map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|err| err.contextrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error]context().(context))
168 }
169 }
170
171 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
172 fn decoding_errors_are_sync_sendrust-analyzer cargo bendy 0.6.1 decoding/error/decoding_errors_are_sync_send().() {
173 use craterust-analyzer cargo bendy 0.6.1 crate/::decodingrust-analyzer cargo bendy 0.6.1 decoding/::errorrust-analyzer cargo bendy 0.6.1 decoding/error/::{Errorrust-analyzer cargo bendy 0.6.1 decoding/error/Error#, ErrorKindrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#};
174 fn is_sendrust-analyzer cargo bendy 0.6.1 decoding/error/is_send().<T: Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#>() {}
175 fn is_syncrust-analyzer cargo bendy 0.6.1 decoding/error/is_sync().<T: Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync#>() {}
176 is_sendrust-analyzer cargo bendy 0.6.1 decoding/error/is_send().::<Errorrust-analyzer cargo bendy 0.6.1 decoding/error/Error#>();
177 is_sendrust-analyzer cargo bendy 0.6.1 decoding/error/is_send().::<ErrorKindrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#>();
178 is_syncrust-analyzer cargo bendy 0.6.1 decoding/error/is_sync().::<Errorrust-analyzer cargo bendy 0.6.1 decoding/error/Error#>();
179 is_syncrust-analyzer cargo bendy 0.6.1 decoding/error/is_sync().::<ErrorKindrust-analyzer cargo bendy 0.6.1 decoding/error/ErrorKind#>();
180 }
181
182 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
•183 #[cfg(feature = "std")]
184 fn error_context_is_displayedrust-analyzer cargo bendy 0.6.1 decoding/error/error_context_is_displayed().() {
185 let e:Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo bendy 0.6.1 decoding/error/Error#> = Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo bendy 0.6.1 decoding/error/Error#::missing_fieldrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[Error]missing_field().("aaa")).contextrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[`Result<T, Error>`][ResultExt]context().("bbb").contextrust-analyzer cargo bendy 0.6.1 decoding/error/impl#[`Result<T, Error>`][ResultExt]context().("ccc");
186 let e = e.unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().();
187 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{}", &e);
188 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(e.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().("aaa\n"));
189 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(e.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().("in context:\n"));
190 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(e.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().("bbb\n"));
191 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(e.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().("ccc"));
192 }