Debian Codegraph @

src/error.rs

raw symbols SCIP
1 use pyo3rust-analyzer cargo pyo3 0.28.1 crate/::PyErrrust-analyzer cargo pyo3 0.28.1 err/PyErr#;
2 use pyo3rust-analyzer cargo pyo3 0.28.1 crate/::{exceptionsrust-analyzer cargo pyo3 0.28.1 exceptions/::*, CastErrorrust-analyzer cargo pyo3 0.28.1 err/cast_error/CastError#, CastIntoErrorrust-analyzer cargo pyo3 0.28.1 err/cast_error/CastIntoError#};
3 use serderust-analyzer cargo serde 1.0.228 crate/::{derust-analyzer cargo serde_core 1.0.228 de/, serrust-analyzer cargo serde_core 1.0.228 ser/};
4 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::convertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/::Infalliblerust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Infallible#;
5 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/;
6 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::{selfrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#, Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#};
7 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/;
8
9 /// Alias for `std::result::Result` with error type `PythonizeError`
10 pub type Resultrust-analyzer cargo pythonize 0.28.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, PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#>;
11
12 /// Errors that can occur when serializing/deserializing Python objects
13 pub struct PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError# {
14 pub(craterust-analyzer cargo pythonize 0.28.0 crate/) innerrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#inner.: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#>,
15 }
16
17 impl PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError# {
18 pub(craterust-analyzer cargo pythonize 0.28.0 crate/) fn msgrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError]msg().<T>(text: T) -> Selfrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError]
19 where
20 T: ToStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/ToString#,
21 {
22 Selfrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError] {
23 innerrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#inner.: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::Messagerust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#Message#(text.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/ToString#to_string().())),
24 }
25 }
26
27 pub(craterust-analyzer cargo pythonize 0.28.0 crate/) fn unsupported_typerust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError]unsupported_type().<T>(t: T) -> Selfrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError]
28 where
29 T: ToStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/ToString#,
30 {
31 Selfrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError] {
32 innerrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#inner.: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::UnsupportedTyperust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#UnsupportedType#(t.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/ToString#to_string().())),
33 }
34 }
35
36 pub(craterust-analyzer cargo pythonize 0.28.0 crate/) fn dict_key_not_stringrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError]dict_key_not_string().() -> Selfrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError] {
37 Selfrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError] {
38 innerrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#inner.: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::DictKeyNotStringrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#DictKeyNotString#),
39 }
40 }
41
42 pub(craterust-analyzer cargo pythonize 0.28.0 crate/) fn incorrect_sequence_lengthrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError]incorrect_sequence_length().(expected: usize, got: usize) -> Selfrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError] {
43 Selfrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError] {
44 innerrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#inner.: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::IncorrectSequenceLengthrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#IncorrectSequenceLength# { expectedrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#IncorrectSequenceLength#expected., gotrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#IncorrectSequenceLength#got. }),
45 }
46 }
47
48 pub(craterust-analyzer cargo pythonize 0.28.0 crate/) fn invalid_enum_typerust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError]invalid_enum_type().() -> Selfrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError] {
49 Selfrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError] {
50 innerrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#inner.: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::InvalidEnumTyperust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#InvalidEnumType#),
51 }
52 }
53
54 pub(craterust-analyzer cargo pythonize 0.28.0 crate/) fn invalid_length_enumrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError]invalid_length_enum().() -> Selfrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError] {
55 Selfrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError] {
56 innerrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#inner.: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::InvalidLengthEnumrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#InvalidLengthEnum#),
57 }
58 }
59
60 pub(craterust-analyzer cargo pythonize 0.28.0 crate/) fn invalid_length_charrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError]invalid_length_char().() -> Selfrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError] {
61 Selfrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError] {
62 innerrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#inner.: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::InvalidLengthCharrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#InvalidLengthChar#),
63 }
64 }
65 }
66
67 /// Error codes for problems that can occur when serializing/deserializing Python objects
68 #[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:)]
69 pub enum ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl# {
70 /// An error originating from the Python runtime
71 PyErrrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#PyErr#(PyErrrust-analyzer cargo pyo3 0.28.1 err/PyErr#),
72 /// Generic error message
73 Messagerust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#Message#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#),
74 /// A Python type not supported by the deserializer
75 UnsupportedTyperust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#UnsupportedType#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#),
76 /// A `PyAny` object that failed to cast to an expected Python type
77 UnexpectedTyperust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#UnexpectedType#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#),
78 /// Dict keys should be strings to deserialize to struct fields
79 DictKeyNotStringrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#DictKeyNotString#,
80 /// Sequence length did not match expected tuple or tuple struct length.
81 IncorrectSequenceLengthrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#IncorrectSequenceLength# { expectedrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#IncorrectSequenceLength#expected.: usize, gotrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#IncorrectSequenceLength#got.: usize },
82 /// Enum variants should either be dict (tagged) or str (variant)
83 InvalidEnumTyperust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#InvalidEnumType#,
84 /// Tagged enum variants should be a dict with exactly 1 key
85 InvalidLengthEnumrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#InvalidLengthEnum#,
86 /// Expected a `char`, but got a Python str that was not length 1
87 InvalidLengthCharrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#InvalidLengthChar#,
88 }
89
90 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 PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError# {}
91
92 impl Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError# {
93 fn fmtrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
94 match self.innerrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#inner..as_refrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T, A>`][`AsRef<T>`]as_ref().() {
95 ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::PyErrrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#PyErr#(e) => Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo pyo3 0.28.1 err/impl#[PyErr][Display]fmt().(e, f),
96 ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::Messagerust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#Message#(s) => Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Display]fmt().(s, f),
97 ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::UnsupportedTyperust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#UnsupportedType#(s) => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "unsupported type {}", s),
98 ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::UnexpectedTyperust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#UnexpectedType#(s) => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "unexpected type: {}", s),
99 ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::DictKeyNotStringrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#DictKeyNotString# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("dict keys must have type str"),
100 ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::IncorrectSequenceLengthrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#IncorrectSequenceLength# { expectedrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#IncorrectSequenceLength#expected., gotrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#IncorrectSequenceLength#got. } => {
101 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "expected sequence of length {}, got {}", expected, got)
102 }
103 ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::InvalidEnumTyperust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#InvalidEnumType# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("expected either a str or dict for enum"),
104 ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::InvalidLengthEnumrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#InvalidLengthEnum# => {
105 f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("expected tagged enum dict to have exactly 1 key")
106 }
107 ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::InvalidLengthCharrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#InvalidLengthChar# => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("expected a str of length 1 for char"),
108 }
109 }
110 }
111
112 impl Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError# {
113 fn fmtrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError][Debug]fmt().(&self, f: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
114 self.innerrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#inner..as_refrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T, A>`][`AsRef<T>`]as_ref().().fmtrust-analyzer cargo pythonize 0.28.0 error/impl#[ErrorImpl][Debug]fmt().(f)
115 }
116 }
117
118 impl serrust-analyzer cargo serde_core 1.0.228 ser/::Errorrust-analyzer cargo serde_core 1.0.228 ser/Error# for PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError# {
119 fn customrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError][Error]custom().<T>(msg: T) -> Selfrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError][Error]
120 where
121 T: Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#,
122 {
123 Selfrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError][Error] {
124 innerrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#inner.: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::Messagerust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#Message#(msg.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())),
125 }
126 }
127 }
128
129 impl derust-analyzer cargo serde_core 1.0.228 de/::Errorrust-analyzer cargo serde_core 1.0.228 de/Error# for PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError# {
130 fn customrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError][Error]custom().<T>(msg: T) -> Selfrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError][Error]
131 where
132 T: Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#,
133 {
134 Selfrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError][Error] {
135 innerrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#inner.: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::Messagerust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#Message#(msg.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())),
136 }
137 }
138 }
139
140 /// Convert an exception raised in Python to a `PythonizeError`
141 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Infalliblerust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Infallible#> for PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError# {
142 fn fromrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError][`From<Infallible>`]from().(other: Infalliblerust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Infallible#) -> Selfrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError][`From<Infallible>`] {
143 match other {}
144 }
145 }
146
147 /// Convert an exception raised in Python to a `PythonizeError`
148 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<PyErrrust-analyzer cargo pyo3 0.28.1 err/PyErr#> for PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError# {
149 fn fromrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError][`From<PyErr>`]from().(other: PyErrrust-analyzer cargo pyo3 0.28.1 err/PyErr#) -> Selfrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError][`From<PyErr>`] {
150 Selfrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError][`From<PyErr>`] {
151 innerrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#inner.: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::PyErrrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#PyErr#(other)),
152 }
153 }
154 }
155
156 /// Handle errors that occur when attempting to use `PyAny::cast`
157 impl<'a, 'py> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<CastErrorrust-analyzer cargo pyo3 0.28.1 err/cast_error/CastError#<'a, 'py>> for PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError# {
158 fn fromrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError][`From<CastError<'a, 'py>>`]from().(other: CastErrorrust-analyzer cargo pyo3 0.28.1 err/cast_error/CastError#<'a, 'py>) -> Selfrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError][`From<CastError<'a, 'py>>`] {
159 Selfrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError][`From<CastError<'a, 'py>>`] {
160 innerrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#inner.: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::UnexpectedTyperust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#UnexpectedType#(other.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())),
161 }
162 }
163 }
164
165 /// Handle errors that occur when attempting to use `PyAny::cast`
166 impl<'py> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<CastIntoErrorrust-analyzer cargo pyo3 0.28.1 err/cast_error/CastIntoError#<'py>> for PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError# {
167 fn fromrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError][`From<CastIntoError<'py>>`]from().(other: CastIntoErrorrust-analyzer cargo pyo3 0.28.1 err/cast_error/CastIntoError#<'py>) -> Selfrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError][`From<CastIntoError<'py>>`] {
168 Selfrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError][`From<CastIntoError<'py>>`] {
169 innerrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#inner.: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::UnexpectedTyperust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#UnexpectedType#(other.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())),
170 }
171 }
172 }
173
174 /// Convert a `PythonizeError` to a Python exception
175 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#> for PyErrrust-analyzer cargo pyo3 0.28.1 err/PyErr# {
176 fn fromrust-analyzer cargo pythonize 0.28.0 error/impl#[PyErr][`From<PythonizeError>`]from().(other: PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#) -> Selfrust-analyzer cargo pythonize 0.28.0 error/impl#[PyErr][`From<PythonizeError>`] {
177 match *rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T, A>`][Deref]deref().other.innerrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#inner. {
178 ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::PyErrrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#PyErr#(e) => e,
179 ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::Messagerust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#Message#(e) => PyExceptionrust-analyzer cargo pyo3 0.28.1 exceptions/PyException#::new_errrust-analyzer cargo pyo3 0.28.1 exceptions/impl#[PyException]new_err().(e),
180 ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::UnsupportedTyperust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#UnsupportedType#(_)
181 | ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::UnexpectedTyperust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#UnexpectedType#(_)
182 | ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::DictKeyNotStringrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#DictKeyNotString#
183 | ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::InvalidEnumTyperust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#InvalidEnumType# => PyTypeErrorrust-analyzer cargo pyo3 0.28.1 exceptions/PyTypeError#::new_errrust-analyzer cargo pyo3 0.28.1 exceptions/impl#[PyTypeError]new_err().(other.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()),
184 ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::IncorrectSequenceLengthrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#IncorrectSequenceLength# { .. }
185 | ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::InvalidLengthEnumrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#InvalidLengthEnum#
186 | ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::InvalidLengthCharrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#InvalidLengthChar# => PyValueErrorrust-analyzer cargo pyo3 0.28.1 exceptions/PyValueError#::new_errrust-analyzer cargo pyo3 0.28.1 exceptions/impl#[PyValueError]new_err().(other.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()),
187 }
188 }
189 }