| 1 | use pyo3rust-analyzer cargo pyo3 0.28.1 crate/::exceptionsrust-analyzer cargo pyo3 0.28.1 exceptions/::PyKeyErrorrust-analyzer cargo pyo3 0.28.1 exceptions/PyKeyError#; |
| 2 | use pyo3rust-analyzer cargo pyo3 0.28.1 crate/::{internrust-analyzer cargo pyo3 0.28.1 sync/intern!, typesrust-analyzer cargo pyo3 0.28.1 types/::*, Boundrust-analyzer cargo pyo3 0.28.1 instance/Bound#}; |
| 3 | use serderust-analyzer cargo serde 1.0.228 crate/::derust-analyzer cargo serde_core 1.0.228 de/::{selfrust-analyzer cargo serde_core 1.0.228 de/, IntoDeserializerrust-analyzer cargo serde_core 1.0.228 de/IntoDeserializer#}; |
| 4 | use serderust-analyzer cargo serde 1.0.228 crate/::Deserializerust-analyzer cargo serde_core 1.0.228 de/Deserialize#; |
| 5 | |
| 6 | use craterust-analyzer cargo pythonize 0.28.0 crate/::errorrust-analyzer cargo pythonize 0.28.0 error/::{ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#, PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#, Resultrust-analyzer cargo pythonize 0.28.0 error/Result#}; |
| 7 | |
| 8 | #[cfg(feature = "arbitrary_precision")] |
| 9 | const TOKENrust-analyzer cargo pythonize 0.28.0 de/TOKEN.: &str = "$serde_json::private::Number"; |
| 10 | |
| 11 | /// Attempt to convert a Python object to an instance of `T`. |
| 12 | /// |
| 13 | /// Generally this only supports Python types that match `serde`'s object model well: |
| 14 | /// - integers (including arbitrary precision integers if the `arbitrary_precision` feature is enabled) |
| 15 | /// - floats |
| 16 | /// - strings |
| 17 | /// - bytes |
| 18 | /// - `collections.abc.Sequence` instances (as serde sequences) |
| 19 | /// - `collections.abc.Mapping` instances (as serde maps) |
| 20 | /// - dataclasses (as serde maps) |
| 21 | pub fn depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().<'a, 'py, T>(obj: &'a Boundrust-analyzer cargo pyo3 0.28.1 instance/Bound#<'py, PyAnyrust-analyzer cargo pyo3 0.28.1 types/any/PyAny#>) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<T> |
| 22 | where |
| 23 | T: Deserializerust-analyzer cargo serde_core 1.0.228 de/Deserialize#<'a>, |
| 24 | { |
| 25 | T::deserializerust-analyzer cargo serde_core 1.0.228 de/Deserialize#deserialize().(&mut Depythonizerrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#::from_objectrust-analyzer cargo pythonize 0.28.0 de/impl#[`Depythonizer<'a, 'py>`]from_object().(obj)) |
| 26 | } |
| 27 | |
| 28 | /// A structure that deserializes Python objects into Rust values |
| 29 | pub struct Depythonizerrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#<'a, 'py> { |
| 30 | inputrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#input.: &'a Boundrust-analyzer cargo pyo3 0.28.1 instance/Bound#<'py, PyAnyrust-analyzer cargo pyo3 0.28.1 types/any/PyAny#>, |
| 31 | } |
| 32 | |
| 33 | impl<'a, 'py> Depythonizerrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#<'a, 'py> { |
| 34 | /// Create a deserializer from a Python object |
| 35 | pub fn from_objectrust-analyzer cargo pythonize 0.28.0 de/impl#[`Depythonizer<'a, 'py>`]from_object().(input: &'a Boundrust-analyzer cargo pyo3 0.28.1 instance/Bound#<'py, PyAnyrust-analyzer cargo pyo3 0.28.1 types/any/PyAny#>) -> Selfrust-analyzer cargo pythonize 0.28.0 de/impl#[`Depythonizer<'a, 'py>`] { |
| 36 | Depythonizerrust-analyzer cargo pythonize 0.28.0 de/Depythonizer# { inputrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#input. } |
| 37 | } |
| 38 | |
| 39 | fn sequence_accessrust-analyzer cargo pythonize 0.28.0 de/impl#[`Depythonizer<'a, 'py>`]sequence_access().(&self, expected_len: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<PySequenceAccessrust-analyzer cargo pythonize 0.28.0 de/PySequenceAccess#<'a, 'py>> { |
| 40 | let seq = self.inputrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#input..castrust-analyzer cargo pyo3 0.28.1 instance/impl#[`Bound<'py, T>`]cast().::<PySequencerust-analyzer cargo pyo3 0.28.1 types/sequence/PySequence#>()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 41 | let len = self.inputrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#input..lenrust-analyzer cargo pyo3 0.28.1 types/any/impl#[`Bound<'py, PyAny>`][`PyAnyMethods<'py>`]len().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 42 | |
| 43 | match expected_len { |
| 44 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(expected) if expected rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().len => { |
| 45 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#::incorrect_sequence_lengthrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError]incorrect_sequence_length().(expected, len)) |
| 46 | } |
| 47 | _ => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(PySequenceAccessrust-analyzer cargo pythonize 0.28.0 de/PySequenceAccess#::newrust-analyzer cargo pythonize 0.28.0 de/impl#[`PySequenceAccess<'a, 'py>`]new().(seq, len)), |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | fn set_accessrust-analyzer cargo pythonize 0.28.0 de/impl#[`Depythonizer<'a, 'py>`]set_access().(&self) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<PySetAsSequencerust-analyzer cargo pythonize 0.28.0 de/PySetAsSequence#<'py>> { |
| 52 | match self.inputrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#input..castrust-analyzer cargo pyo3 0.28.1 instance/impl#[`Bound<'py, T>`]cast().::<PySetrust-analyzer cargo pyo3 0.28.1 types/set/PySet#>() { |
| 53 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(set) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(PySetAsSequencerust-analyzer cargo pythonize 0.28.0 de/PySetAsSequence#::from_setrust-analyzer cargo pythonize 0.28.0 de/impl#[`PySetAsSequence<'py>`]from_set().(set)), |
| 54 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e) => { |
| 55 | if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(f) = self.inputrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#input..castrust-analyzer cargo pyo3 0.28.1 instance/impl#[`Bound<'py, T>`]cast().::<PyFrozenSetrust-analyzer cargo pyo3 0.28.1 types/frozenset/PyFrozenSet#>() { |
| 56 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(PySetAsSequencerust-analyzer cargo pythonize 0.28.0 de/PySetAsSequence#::from_frozensetrust-analyzer cargo pythonize 0.28.0 de/impl#[`PySetAsSequence<'py>`]from_frozenset().(f)) |
| 57 | } else { |
| 58 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | fn dict_accessrust-analyzer cargo pythonize 0.28.0 de/impl#[`Depythonizer<'a, 'py>`]dict_access().(&self) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<PyMappingAccessrust-analyzer cargo pythonize 0.28.0 de/PyMappingAccess#<'py>> { |
| 65 | PyMappingAccessrust-analyzer cargo pythonize 0.28.0 de/PyMappingAccess#::newrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyMappingAccess<'py>`]new().(self.inputrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#input..castrust-analyzer cargo pyo3 0.28.1 instance/impl#[`Bound<'py, T>`]cast().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().) |
| 66 | } |
| 67 | |
| 68 | fn dataclass_accessrust-analyzer cargo pythonize 0.28.0 de/impl#[`Depythonizer<'a, 'py>`]dataclass_access().(&self) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PyDataclassAccessrust-analyzer cargo pythonize 0.28.0 de/PyDataclassAccess#<'py>>> { |
| 69 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(dc) = DataclassCandidaterust-analyzer cargo pythonize 0.28.0 de/DataclassCandidate#::try_newrust-analyzer cargo pythonize 0.28.0 de/impl#[`DataclassCandidate<'a, 'py>`]try_new().(self.inputrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#input.) { |
| 70 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(PyDataclassAccessrust-analyzer cargo pythonize 0.28.0 de/PyDataclassAccess#::newrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyDataclassAccess<'py>`]new().(dc)).transposerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<Result<T, E>>`]transpose().() |
| 71 | } else { |
| 72 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | fn deserialize_any_intrust-analyzer cargo pythonize 0.28.0 de/impl#[`Depythonizer<'a, 'py>`]deserialize_any_int().<'de, V>(&self, int: &Boundrust-analyzer cargo pyo3 0.28.1 instance/Bound#<'_, PyIntrust-analyzer cargo pyo3 0.28.1 types/num/PyInt#>, visitor: V) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#> |
| 77 | where |
| 78 | V: derust-analyzer cargo serde_core 1.0.228 de/::Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#<'de>, |
| 79 | { |
| 80 | if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(x) = int.extractrust-analyzer cargo pyo3 0.28.1 types/any/impl#[`Bound<'py, PyAny>`][`PyAnyMethods<'py>`]extract().::<u128>() { |
| 81 | if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(x) = u8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u8][`TryFrom<u128>`]try_from().(x) { |
| 82 | visitor.visit_u8rust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_u8().(x) |
| 83 | } else if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(x) = u16::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u16][`TryFrom<u128>`]try_from().(x) { |
| 84 | visitor.visit_u16rust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_u16().(x) |
| 85 | } else if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(x) = u32::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u32][`TryFrom<u128>`]try_from().(x) { |
| 86 | visitor.visit_u32rust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_u32().(x) |
| 87 | } else if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(x) = u64::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u64][`TryFrom<u128>`]try_from().(x) { |
| 88 | visitor.visit_u64rust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_u64().(x) |
| 89 | } else { |
| 90 | visitor.visit_u128rust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_u128().(x) |
| 91 | } |
| 92 | } else if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(x) = int.extractrust-analyzer cargo pyo3 0.28.1 types/any/impl#[`Bound<'py, PyAny>`][`PyAnyMethods<'py>`]extract().::<i128>() { |
| 93 | if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(x) = i8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i8][`TryFrom<i128>`]try_from().(x) { |
| 94 | visitor.visit_i8rust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_i8().(x) |
| 95 | } else if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(x) = i16::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i16][`TryFrom<i128>`]try_from().(x) { |
| 96 | visitor.visit_i16rust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_i16().(x) |
| 97 | } else if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(x) = i32::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i32][`TryFrom<i128>`]try_from().(x) { |
| 98 | visitor.visit_i32rust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_i32().(x) |
| 99 | } else if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(x) = i64::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[i64][`TryFrom<i128>`]try_from().(x) { |
| 100 | visitor.visit_i64rust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_i64().(x) |
| 101 | } else { |
| 102 | visitor.visit_i128rust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_i128().(x) |
| 103 | } |
| 104 | } else { |
| 105 | #[cfg(feature = "arbitrary_precision")] |
| 106 | { |
| 107 | visitor.visit_maprust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_map().(NumberDeserializerrust-analyzer cargo pythonize 0.28.0 de/NumberDeserializer# { |
| 108 | numberrust-analyzer cargo pythonize 0.28.0 de/NumberDeserializer#number.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(int.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), |
| 109 | }) |
| 110 | } |
| 111 | #[cfg(not(feature = "arbitrary_precision"))] |
| 112 | { |
| 113 | // Re-attempt to return the original error. |
| 114 | let _: i128 = int.extract()?; |
| 115 | unreachablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/unreachable!!() |
| 116 | } |
| 117 | } |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | macro_rules! deserialize_typerust-analyzer cargo pythonize 0.28.0 de/deserialize_type! { |
| 122 | ($method:ident => $visit:ident) => { |
| 123 | fn $method<V>(self, visitor: V) -> Result<V::Value> |
| 124 | where |
| 125 | V: de::Visitor<'de>, |
| 126 | { |
| 127 | visitor.$visit(self.input.extract()?) |
| 128 | } |
| 129 | }; |
| 130 | } |
| 131 | |
| 132 | impl<'de> derust-analyzer cargo serde_core 1.0.228 de/::Deserializerrust-analyzer cargo serde_core 1.0.228 de/Deserializer#<'de> for &'_ mut Depythonizerrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#<'_, '_> { |
| 133 | type Errorrust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]Error# = PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#; |
| 134 | |
| 135 | fn deserialize_anyrust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_any().<V>(self, visitor: V) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#> |
| 136 | where |
| 137 | V: derust-analyzer cargo serde_core 1.0.228 de/::Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#<'de>, |
| 138 | { |
| 139 | let obj = self.inputrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#input.; |
| 140 | |
| 141 | // First check for cases which are cheap to check due to pointer |
| 142 | // comparison or bitflag checks |
| 143 | if obj.is_nonerust-analyzer cargo pyo3 0.28.1 types/any/impl#[`Bound<'py, PyAny>`][`PyAnyMethods<'py>`]is_none().() { |
| 144 | self.deserialize_unitrust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_unit().(visitor) |
| 145 | } else if obj.is_instance_ofrust-analyzer cargo pyo3 0.28.1 types/any/impl#[`Bound<'py, PyAny>`][`PyAnyMethods<'py>`]is_instance_of().::<PyBoolrust-analyzer cargo pyo3 0.28.1 types/boolobject/PyBool#>() { |
| 146 | self.deserialize_boolrust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_bool().(visitor) |
| 147 | } else if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(x) = obj.castrust-analyzer cargo pyo3 0.28.1 instance/impl#[`Bound<'py, T>`]cast().::<PyIntrust-analyzer cargo pyo3 0.28.1 types/num/PyInt#>() { |
| 148 | self.deserialize_any_intrust-analyzer cargo pythonize 0.28.0 de/impl#[`Depythonizer<'a, 'py>`]deserialize_any_int().(x, visitor) |
| 149 | } else if obj.is_instance_ofrust-analyzer cargo pyo3 0.28.1 types/any/impl#[`Bound<'py, PyAny>`][`PyAnyMethods<'py>`]is_instance_of().::<PyListrust-analyzer cargo pyo3 0.28.1 types/list/PyList#>() || obj.is_instance_ofrust-analyzer cargo pyo3 0.28.1 types/any/impl#[`Bound<'py, PyAny>`][`PyAnyMethods<'py>`]is_instance_of().::<PyTuplerust-analyzer cargo pyo3 0.28.1 types/tuple/PyTuple#>() { |
| 150 | self.deserialize_tuplerust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_tuple().(obj.lenrust-analyzer cargo pyo3 0.28.1 types/any/impl#[`Bound<'py, PyAny>`][`PyAnyMethods<'py>`]len().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., visitor) |
| 151 | } else if obj.is_instance_ofrust-analyzer cargo pyo3 0.28.1 types/any/impl#[`Bound<'py, PyAny>`][`PyAnyMethods<'py>`]is_instance_of().::<PyDictrust-analyzer cargo pyo3 0.28.1 types/dict/PyDict#>() { |
| 152 | self.deserialize_maprust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_map().(visitor) |
| 153 | } else if obj.is_instance_ofrust-analyzer cargo pyo3 0.28.1 types/any/impl#[`Bound<'py, PyAny>`][`PyAnyMethods<'py>`]is_instance_of().::<PyStringrust-analyzer cargo pyo3 0.28.1 types/string/PyString#>() { |
| 154 | self.deserialize_strrust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_str().(visitor) |
| 155 | } |
| 156 | // Continue with cases which are slower to check because they go |
| 157 | // through `isinstance` machinery |
| 158 | else if obj.is_instance_ofrust-analyzer cargo pyo3 0.28.1 types/any/impl#[`Bound<'py, PyAny>`][`PyAnyMethods<'py>`]is_instance_of().::<PyBytesrust-analyzer cargo pyo3 0.28.1 types/bytes/PyBytes#>() || obj.is_instance_ofrust-analyzer cargo pyo3 0.28.1 types/any/impl#[`Bound<'py, PyAny>`][`PyAnyMethods<'py>`]is_instance_of().::<PyByteArrayrust-analyzer cargo pyo3 0.28.1 types/bytearray/PyByteArray#>() { |
| 159 | self.deserialize_bytesrust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_bytes().(visitor) |
| 160 | } else if obj.is_instance_ofrust-analyzer cargo pyo3 0.28.1 types/any/impl#[`Bound<'py, PyAny>`][`PyAnyMethods<'py>`]is_instance_of().::<PyFloatrust-analyzer cargo pyo3 0.28.1 types/float/PyFloat#>() { |
| 161 | self.deserialize_f64rust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_f64().(visitor) |
| 162 | } else if obj.is_instance_ofrust-analyzer cargo pyo3 0.28.1 types/any/impl#[`Bound<'py, PyAny>`][`PyAnyMethods<'py>`]is_instance_of().::<PyFrozenSetrust-analyzer cargo pyo3 0.28.1 types/frozenset/PyFrozenSet#>() || obj.is_instance_ofrust-analyzer cargo pyo3 0.28.1 types/any/impl#[`Bound<'py, PyAny>`][`PyAnyMethods<'py>`]is_instance_of().::<PySetrust-analyzer cargo pyo3 0.28.1 types/set/PySet#>() { |
| 163 | self.deserialize_seqrust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_seq().(visitor) |
| 164 | } else if obj.castrust-analyzer cargo pyo3 0.28.1 instance/impl#[`Bound<'py, T>`]cast().::<PySequencerust-analyzer cargo pyo3 0.28.1 types/sequence/PySequence#>().is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().() { |
| 165 | self.deserialize_tuplerust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_tuple().(obj.lenrust-analyzer cargo pyo3 0.28.1 types/any/impl#[`Bound<'py, PyAny>`][`PyAnyMethods<'py>`]len().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., visitor) |
| 166 | } else if obj.castrust-analyzer cargo pyo3 0.28.1 instance/impl#[`Bound<'py, T>`]cast().::<PyMappingrust-analyzer cargo pyo3 0.28.1 types/mapping/PyMapping#>().is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().() { |
| 167 | self.deserialize_maprust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_map().(visitor) |
| 168 | } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(dc) = DataclassCandidaterust-analyzer cargo pythonize 0.28.0 de/DataclassCandidate#::try_newrust-analyzer cargo pythonize 0.28.0 de/impl#[`DataclassCandidate<'a, 'py>`]try_new().(obj) { |
| 169 | visitor.visit_maprust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_map().(PyDataclassAccessrust-analyzer cargo pythonize 0.28.0 de/PyDataclassAccess#::newrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyDataclassAccess<'py>`]new().(dc)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().) |
| 170 | } else { |
| 171 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(obj.get_typerust-analyzer cargo pyo3 0.28.1 types/any/impl#[`Bound<'py, PyAny>`][`PyAnyMethods<'py>`]get_type().().qualnamerust-analyzer cargo pyo3 0.28.1 types/typeobject/impl#[`Bound<'py, PyType>`][`PyTypeMethods<'py>`]qualname().().map_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_or_else().( |
| 172 | |_| PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#::unsupported_typerust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError]unsupported_type().("unknown"), |
| 173 | PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#::unsupported_typerust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError]unsupported_type()., |
| 174 | )) |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | fn deserialize_boolrust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_bool().<V>(self, visitor: V) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#> |
| 179 | where |
| 180 | V: derust-analyzer cargo serde_core 1.0.228 de/::Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#<'de>, |
| 181 | { |
| 182 | visitor.visit_boolrust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_bool().(self.inputrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#input..is_truthyrust-analyzer cargo pyo3 0.28.1 types/any/impl#[`Bound<'py, PyAny>`][`PyAnyMethods<'py>`]is_truthy().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().) |
| 183 | } |
| 184 | |
| 185 | fn deserialize_charrust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_char().<V>(self, visitor: V) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#> |
| 186 | where |
| 187 | V: derust-analyzer cargo serde_core 1.0.228 de/::Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#<'de>, |
| 188 | { |
| 189 | let s = self.inputrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#input..castrust-analyzer cargo pyo3 0.28.1 instance/impl#[`Bound<'py, T>`]cast().::<PyStringrust-analyzer cargo pyo3 0.28.1 types/string/PyString#>()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..to_cowrust-analyzer cargo pyo3 0.28.1 types/string/impl#[`Bound<'py, PyString>`][`PyStringMethods<'py>`]to_cow().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 190 | if s.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().1 { |
| 191 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#::invalid_length_charrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError]invalid_length_char().()); |
| 192 | } |
| 193 | visitor.visit_charrust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_char().(s.charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().().nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Chars<'a>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()) |
| 194 | } |
| 195 | |
| 196 | deserialize_typerust-analyzer cargo pythonize 0.28.0 de/deserialize_type!!(deserialize_i8rust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_i8(). => visit_i8rust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_i8().); |
| 197 | deserialize_typerust-analyzer cargo pythonize 0.28.0 de/deserialize_type!!(deserialize_i16rust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_i16(). => visit_i16rust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_i16().); |
| 198 | deserialize_typerust-analyzer cargo pythonize 0.28.0 de/deserialize_type!!(deserialize_i32rust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_i32(). => visit_i32rust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_i32().); |
| 199 | deserialize_typerust-analyzer cargo pythonize 0.28.0 de/deserialize_type!!(deserialize_i64rust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_i64(). => visit_i64rust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_i64().); |
| 200 | deserialize_typerust-analyzer cargo pythonize 0.28.0 de/deserialize_type!!(deserialize_i128rust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_i128(). => visit_i128rust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_i128().); |
| 201 | deserialize_typerust-analyzer cargo pythonize 0.28.0 de/deserialize_type!!(deserialize_u8rust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_u8(). => visit_u8rust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_u8().); |
| 202 | deserialize_typerust-analyzer cargo pythonize 0.28.0 de/deserialize_type!!(deserialize_u16rust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_u16(). => visit_u16rust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_u16().); |
| 203 | deserialize_typerust-analyzer cargo pythonize 0.28.0 de/deserialize_type!!(deserialize_u32rust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_u32(). => visit_u32rust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_u32().); |
| 204 | deserialize_typerust-analyzer cargo pythonize 0.28.0 de/deserialize_type!!(deserialize_u64rust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_u64(). => visit_u64rust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_u64().); |
| 205 | deserialize_typerust-analyzer cargo pythonize 0.28.0 de/deserialize_type!!(deserialize_u128rust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_u128(). => visit_u128rust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_u128().); |
| 206 | deserialize_typerust-analyzer cargo pythonize 0.28.0 de/deserialize_type!!(deserialize_f32rust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_f32(). => visit_f32rust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_f32().); |
| 207 | deserialize_typerust-analyzer cargo pythonize 0.28.0 de/deserialize_type!!(deserialize_f64rust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_f64(). => visit_f64rust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_f64().); |
| 208 | |
| 209 | fn deserialize_strrust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_str().<V>(self, visitor: V) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#> |
| 210 | where |
| 211 | V: derust-analyzer cargo serde_core 1.0.228 de/::Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#<'de>, |
| 212 | { |
| 213 | let s = self.inputrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#input..castrust-analyzer cargo pyo3 0.28.1 instance/impl#[`Bound<'py, T>`]cast().::<PyStringrust-analyzer cargo pyo3 0.28.1 types/string/PyString#>()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 214 | visitor.visit_strrust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_str().(&s.to_cowrust-analyzer cargo pyo3 0.28.1 types/string/impl#[`Bound<'py, PyString>`][`PyStringMethods<'py>`]to_cow().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().) |
| 215 | } |
| 216 | |
| 217 | fn deserialize_stringrust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_string().<V>(self, visitor: V) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#> |
| 218 | where |
| 219 | V: derust-analyzer cargo serde_core 1.0.228 de/::Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#<'de>, |
| 220 | { |
| 221 | self.deserialize_strrust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_str().(visitor) |
| 222 | } |
| 223 | |
| 224 | fn deserialize_bytesrust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_bytes().<V>(self, visitor: V) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#> |
| 225 | where |
| 226 | V: derust-analyzer cargo serde_core 1.0.228 de/::Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#<'de>, |
| 227 | { |
| 228 | let b = self.inputrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#input..castrust-analyzer cargo pyo3 0.28.1 instance/impl#[`Bound<'py, T>`]cast().::<PyBytesrust-analyzer cargo pyo3 0.28.1 types/bytes/PyBytes#>()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 229 | visitor.visit_bytesrust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_bytes().(b.as_bytesrust-analyzer cargo pyo3 0.28.1 types/bytes/impl#[`Bound<'py, PyBytes>`][`PyBytesMethods<'py>`]as_bytes().()) |
| 230 | } |
| 231 | |
| 232 | fn deserialize_byte_bufrust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_byte_buf().<V>(self, visitor: V) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#> |
| 233 | where |
| 234 | V: derust-analyzer cargo serde_core 1.0.228 de/::Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#<'de>, |
| 235 | { |
| 236 | self.deserialize_bytesrust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_bytes().(visitor) |
| 237 | } |
| 238 | |
| 239 | fn deserialize_optionrust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_option().<V>(self, visitor: V) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#> |
| 240 | where |
| 241 | V: derust-analyzer cargo serde_core 1.0.228 de/::Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#<'de>, |
| 242 | { |
| 243 | if self.inputrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#input..is_nonerust-analyzer cargo pyo3 0.28.1 types/any/impl#[`Bound<'py, PyAny>`][`PyAnyMethods<'py>`]is_none().() { |
| 244 | visitor.visit_nonerust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_none().() |
| 245 | } else { |
| 246 | visitor.visit_somerust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_some().(self) |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | fn deserialize_unitrust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_unit().<V>(self, visitor: V) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#> |
| 251 | where |
| 252 | V: derust-analyzer cargo serde_core 1.0.228 de/::Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#<'de>, |
| 253 | { |
| 254 | if self.inputrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#input..is_nonerust-analyzer cargo pyo3 0.28.1 types/any/impl#[`Bound<'py, PyAny>`][`PyAnyMethods<'py>`]is_none().() { |
| 255 | visitor.visit_unitrust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_unit().() |
| 256 | } else { |
| 257 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#::msgrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError]msg().("expected None")) |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | fn deserialize_unit_structrust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_unit_struct().<V>(self, _name: &'static str, visitor: V) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#> |
| 262 | where |
| 263 | V: derust-analyzer cargo serde_core 1.0.228 de/::Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#<'de>, |
| 264 | { |
| 265 | self.deserialize_unitrust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_unit().(visitor) |
| 266 | } |
| 267 | |
| 268 | fn deserialize_newtype_structrust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_newtype_struct().<V>(self, _name: &'static str, visitor: V) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#> |
| 269 | where |
| 270 | V: derust-analyzer cargo serde_core 1.0.228 de/::Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#<'de>, |
| 271 | { |
| 272 | visitor.visit_newtype_structrust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_newtype_struct().(self) |
| 273 | } |
| 274 | |
| 275 | fn deserialize_seqrust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_seq().<V>(self, visitor: V) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#> |
| 276 | where |
| 277 | V: derust-analyzer cargo serde_core 1.0.228 de/::Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#<'de>, |
| 278 | { |
| 279 | match self.sequence_accessrust-analyzer cargo pythonize 0.28.0 de/impl#[`Depythonizer<'a, 'py>`]sequence_access().(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) { |
| 280 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(seq) => visitor.visit_seqrust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_seq().(seq), |
| 281 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e) => { |
| 282 | // we allow sets to be deserialized as sequences, so try that |
| 283 | if matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T, A>`][Deref]deref().e.innerrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#inner., ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::UnexpectedTyperust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#UnexpectedType#(_)) { |
| 284 | if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(set) = self.set_accessrust-analyzer cargo pythonize 0.28.0 de/impl#[`Depythonizer<'a, 'py>`]set_access().() { |
| 285 | return visitor.visit_seqrust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_seq().(set); |
| 286 | } |
| 287 | } |
| 288 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e) |
| 289 | } |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | fn deserialize_tuplerust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_tuple().<V>(self, len: usize, visitor: V) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#> |
| 294 | where |
| 295 | V: derust-analyzer cargo serde_core 1.0.228 de/::Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#<'de>, |
| 296 | { |
| 297 | visitor.visit_seqrust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_seq().(self.sequence_accessrust-analyzer cargo pythonize 0.28.0 de/impl#[`Depythonizer<'a, 'py>`]sequence_access().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(len))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().) |
| 298 | } |
| 299 | |
| 300 | fn deserialize_tuple_structrust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_tuple_struct().<V>( |
| 301 | self, |
| 302 | _name: &'static str, |
| 303 | len: usize, |
| 304 | visitor: V, |
| 305 | ) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#> |
| 306 | where |
| 307 | V: derust-analyzer cargo serde_core 1.0.228 de/::Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#<'de>, |
| 308 | { |
| 309 | visitor.visit_seqrust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_seq().(self.sequence_accessrust-analyzer cargo pythonize 0.28.0 de/impl#[`Depythonizer<'a, 'py>`]sequence_access().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(len))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().) |
| 310 | } |
| 311 | |
| 312 | fn deserialize_maprust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_map().<V>(self, visitor: V) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#> |
| 313 | where |
| 314 | V: derust-analyzer cargo serde_core 1.0.228 de/::Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#<'de>, |
| 315 | { |
| 316 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(dc_access) = self.dataclass_accessrust-analyzer cargo pythonize 0.28.0 de/impl#[`Depythonizer<'a, 'py>`]dataclass_access().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). { |
| 317 | visitor.visit_maprust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_map().(dc_access) |
| 318 | } else { |
| 319 | visitor.visit_maprust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_map().(self.dict_accessrust-analyzer cargo pythonize 0.28.0 de/impl#[`Depythonizer<'a, 'py>`]dict_access().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().) |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | fn deserialize_structrust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_struct().<V>( |
| 324 | self, |
| 325 | _name: &'static str, |
| 326 | _fields: &'static [&'static str], |
| 327 | visitor: V, |
| 328 | ) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#> |
| 329 | where |
| 330 | V: derust-analyzer cargo serde_core 1.0.228 de/::Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#<'de>, |
| 331 | { |
| 332 | self.deserialize_maprust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_map().(visitor) |
| 333 | } |
| 334 | |
| 335 | fn deserialize_enumrust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_enum().<V>( |
| 336 | self, |
| 337 | _name: &'static str, |
| 338 | _variants: &'static [&'static str], |
| 339 | visitor: V, |
| 340 | ) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#> |
| 341 | where |
| 342 | V: derust-analyzer cargo serde_core 1.0.228 de/::Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#<'de>, |
| 343 | { |
| 344 | let item = &self.inputrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#input.; |
| 345 | if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(s) = item.castrust-analyzer cargo pyo3 0.28.1 instance/impl#[`Bound<'py, T>`]cast().::<PyStringrust-analyzer cargo pyo3 0.28.1 types/string/PyString#>() { |
| 346 | visitor.visit_enumrust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_enum().(s.to_cowrust-analyzer cargo pyo3 0.28.1 types/string/impl#[`Bound<'py, PyString>`][`PyStringMethods<'py>`]to_cow().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..into_deserializerrust-analyzer cargo serde_core 1.0.228 de/value/impl#[`Cow<'a, str>`][`IntoDeserializer<'de, E>`]into_deserializer().()) |
| 347 | } else if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(m) = item.castrust-analyzer cargo pyo3 0.28.1 instance/impl#[`Bound<'py, T>`]cast().::<PyMappingrust-analyzer cargo pyo3 0.28.1 types/mapping/PyMapping#>() { |
| 348 | // Get the enum variant from the mapping key |
| 349 | if m.lenrust-analyzer cargo pyo3 0.28.1 types/mapping/impl#[`Bound<'py, PyMapping>`][`PyMappingMethods<'py>`]len().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().1 { |
| 350 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#::invalid_length_enumrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError]invalid_length_enum().()); |
| 351 | } |
| 352 | let variant: Boundrust-analyzer cargo pyo3 0.28.1 instance/Bound#<PyStringrust-analyzer cargo pyo3 0.28.1 types/string/PyString#> = m |
| 353 | .keysrust-analyzer cargo pyo3 0.28.1 types/mapping/impl#[`Bound<'py, PyMapping>`][`PyMappingMethods<'py>`]keys().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 354 | .get_itemrust-analyzer cargo pyo3 0.28.1 types/list/impl#[`Bound<'py, PyList>`][`PyListMethods<'py>`]get_item().(0)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 355 | .cast_intorust-analyzer cargo pyo3 0.28.1 instance/impl#[`Bound<'py, T>`]cast_into().::<PyStringrust-analyzer cargo pyo3 0.28.1 types/string/PyString#>() |
| 356 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#::dict_key_not_stringrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError]dict_key_not_string().())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 357 | let value = m.get_itemrust-analyzer cargo pyo3 0.28.1 types/mapping/impl#[`Bound<'py, PyMapping>`][`PyMappingMethods<'py>`]get_item().(&variant)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 358 | visitor.visit_enumrust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_enum().(PyEnumAccessrust-analyzer cargo pythonize 0.28.0 de/PyEnumAccess#::newrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyEnumAccess<'a, 'py>`]new().(&value, variant)) |
| 359 | } else { |
| 360 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#::invalid_enum_typerust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError]invalid_enum_type().()) |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | fn deserialize_identifierrust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_identifier().<V>(self, visitor: V) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#> |
| 365 | where |
| 366 | V: derust-analyzer cargo serde_core 1.0.228 de/::Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#<'de>, |
| 367 | { |
| 368 | let s = self |
| 369 | .inputrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#input. |
| 370 | .castrust-analyzer cargo pyo3 0.28.1 instance/impl#[`Bound<'py, T>`]cast().::<PyStringrust-analyzer cargo pyo3 0.28.1 types/string/PyString#>() |
| 371 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#::dict_key_not_stringrust-analyzer cargo pythonize 0.28.0 error/impl#[PythonizeError]dict_key_not_string().())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 372 | visitor.visit_strrust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_str().(&s.to_cowrust-analyzer cargo pyo3 0.28.1 types/string/impl#[`Bound<'py, PyString>`][`PyStringMethods<'py>`]to_cow().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().) |
| 373 | } |
| 374 | |
| 375 | fn deserialize_ignored_anyrust-analyzer cargo pythonize 0.28.0 de/impl#[`&mut Depythonizer<'_, '_>`][`Deserializer<'de>`]deserialize_ignored_any().<V>(self, visitor: V) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#> |
| 376 | where |
| 377 | V: derust-analyzer cargo serde_core 1.0.228 de/::Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#<'de>, |
| 378 | { |
| 379 | visitor.visit_unitrust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_unit().() |
| 380 | } |
| 381 | } |
| 382 | |
| 383 | struct PySequenceAccessrust-analyzer cargo pythonize 0.28.0 de/PySequenceAccess#<'a, 'py> { |
| 384 | seqrust-analyzer cargo pythonize 0.28.0 de/PySequenceAccess#seq.: &'a Boundrust-analyzer cargo pyo3 0.28.1 instance/Bound#<'py, PySequencerust-analyzer cargo pyo3 0.28.1 types/sequence/PySequence#>, |
| 385 | indexrust-analyzer cargo pythonize 0.28.0 de/PySequenceAccess#index.: usize, |
| 386 | lenrust-analyzer cargo pythonize 0.28.0 de/PySequenceAccess#len.: usize, |
| 387 | } |
| 388 | |
| 389 | impl<'a, 'py> PySequenceAccessrust-analyzer cargo pythonize 0.28.0 de/PySequenceAccess#<'a, 'py> { |
| 390 | fn newrust-analyzer cargo pythonize 0.28.0 de/impl#[`PySequenceAccess<'a, 'py>`]new().(seq: &'a Boundrust-analyzer cargo pyo3 0.28.1 instance/Bound#<'py, PySequencerust-analyzer cargo pyo3 0.28.1 types/sequence/PySequence#>, len: usize) -> Selfrust-analyzer cargo pythonize 0.28.0 de/impl#[`PySequenceAccess<'a, 'py>`] { |
| 391 | Selfrust-analyzer cargo pythonize 0.28.0 de/impl#[`PySequenceAccess<'a, 'py>`] { seqrust-analyzer cargo pythonize 0.28.0 de/PySequenceAccess#seq., indexrust-analyzer cargo pythonize 0.28.0 de/PySequenceAccess#index.: 0, lenrust-analyzer cargo pythonize 0.28.0 de/PySequenceAccess#len. } |
| 392 | } |
| 393 | } |
| 394 | |
| 395 | impl<'de> derust-analyzer cargo serde_core 1.0.228 de/::SeqAccessrust-analyzer cargo serde_core 1.0.228 de/SeqAccess#<'de> for PySequenceAccessrust-analyzer cargo pythonize 0.28.0 de/PySequenceAccess#<'_, '_> { |
| 396 | type Errorrust-analyzer cargo pythonize 0.28.0 de/impl#[`PySequenceAccess<'_, '_>`][`SeqAccess<'de>`]Error# = PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#; |
| 397 | |
| 398 | fn next_element_seedrust-analyzer cargo pythonize 0.28.0 de/impl#[`PySequenceAccess<'_, '_>`][`SeqAccess<'de>`]next_element_seed().<T>(&mut self, seed: T) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<T::Valuerust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#Value#>> |
| 399 | where |
| 400 | T: derust-analyzer cargo serde_core 1.0.228 de/::DeserializeSeedrust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#<'de>, |
| 401 | { |
| 402 | if self.indexrust-analyzer cargo pythonize 0.28.0 de/PySequenceAccess#index. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().self.lenrust-analyzer cargo pythonize 0.28.0 de/PySequenceAccess#len. { |
| 403 | let item = self.seqrust-analyzer cargo pythonize 0.28.0 de/PySequenceAccess#seq..get_itemrust-analyzer cargo pyo3 0.28.1 types/sequence/impl#[`Bound<'py, PySequence>`][`PySequenceMethods<'py>`]get_item().(self.indexrust-analyzer cargo pythonize 0.28.0 de/PySequenceAccess#index.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 404 | self.indexrust-analyzer cargo pythonize 0.28.0 de/PySequenceAccess#index. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 405 | seed.deserializerust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#deserialize().(&mut Depythonizerrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#::from_objectrust-analyzer cargo pythonize 0.28.0 de/impl#[`Depythonizer<'a, 'py>`]from_object().(&item)) |
| 406 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#) |
| 407 | } else { |
| 408 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) |
| 409 | } |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | struct PySetAsSequencerust-analyzer cargo pythonize 0.28.0 de/PySetAsSequence#<'py> { |
| 414 | iterrust-analyzer cargo pythonize 0.28.0 de/PySetAsSequence#iter.: Boundrust-analyzer cargo pyo3 0.28.1 instance/Bound#<'py, PyIteratorrust-analyzer cargo pyo3 0.28.1 types/iterator/PyIterator#>, |
| 415 | } |
| 416 | |
| 417 | impl<'py> PySetAsSequencerust-analyzer cargo pythonize 0.28.0 de/PySetAsSequence#<'py> { |
| 418 | fn from_setrust-analyzer cargo pythonize 0.28.0 de/impl#[`PySetAsSequence<'py>`]from_set().(set: &Boundrust-analyzer cargo pyo3 0.28.1 instance/Bound#<'py, PySetrust-analyzer cargo pyo3 0.28.1 types/set/PySet#>) -> Selfrust-analyzer cargo pythonize 0.28.0 de/impl#[`PySetAsSequence<'py>`] { |
| 419 | Selfrust-analyzer cargo pythonize 0.28.0 de/impl#[`PySetAsSequence<'py>`] { |
| 420 | iterrust-analyzer cargo pythonize 0.28.0 de/PySetAsSequence#iter.: PyIteratorrust-analyzer cargo pyo3 0.28.1 types/iterator/PyIterator#::from_objectrust-analyzer cargo pyo3 0.28.1 types/iterator/impl#[PyIterator]from_object().(set).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("set is always iterable"), |
| 421 | } |
| 422 | } |
| 423 | |
| 424 | fn from_frozensetrust-analyzer cargo pythonize 0.28.0 de/impl#[`PySetAsSequence<'py>`]from_frozenset().(set: &Boundrust-analyzer cargo pyo3 0.28.1 instance/Bound#<'py, PyFrozenSetrust-analyzer cargo pyo3 0.28.1 types/frozenset/PyFrozenSet#>) -> Selfrust-analyzer cargo pythonize 0.28.0 de/impl#[`PySetAsSequence<'py>`] { |
| 425 | Selfrust-analyzer cargo pythonize 0.28.0 de/impl#[`PySetAsSequence<'py>`] { |
| 426 | iterrust-analyzer cargo pythonize 0.28.0 de/PySetAsSequence#iter.: PyIteratorrust-analyzer cargo pyo3 0.28.1 types/iterator/PyIterator#::from_objectrust-analyzer cargo pyo3 0.28.1 types/iterator/impl#[PyIterator]from_object().(set).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("frozenset is always iterable"), |
| 427 | } |
| 428 | } |
| 429 | } |
| 430 | |
| 431 | impl<'de> derust-analyzer cargo serde_core 1.0.228 de/::SeqAccessrust-analyzer cargo serde_core 1.0.228 de/SeqAccess#<'de> for PySetAsSequencerust-analyzer cargo pythonize 0.28.0 de/PySetAsSequence#<'_> { |
| 432 | type Errorrust-analyzer cargo pythonize 0.28.0 de/impl#[`PySetAsSequence<'_>`][`SeqAccess<'de>`]Error# = PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#; |
| 433 | |
| 434 | fn next_element_seedrust-analyzer cargo pythonize 0.28.0 de/impl#[`PySetAsSequence<'_>`][`SeqAccess<'de>`]next_element_seed().<T>(&mut self, seed: T) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<T::Valuerust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#Value#>> |
| 435 | where |
| 436 | T: derust-analyzer cargo serde_core 1.0.228 de/::DeserializeSeedrust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#<'de>, |
| 437 | { |
| 438 | match self.iterrust-analyzer cargo pythonize 0.28.0 de/PySetAsSequence#iter..nextrust-analyzer cargo pyo3 0.28.1 types/iterator/impl#[`Bound<'py, PyIterator>`][Iterator]next().() { |
| 439 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(item) => seed |
| 440 | .deserializerust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#deserialize().(&mut Depythonizerrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#::from_objectrust-analyzer cargo pythonize 0.28.0 de/impl#[`Depythonizer<'a, 'py>`]from_object().(&item?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().)) |
| 441 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#), |
| 442 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#), |
| 443 | } |
| 444 | } |
| 445 | } |
| 446 | |
| 447 | struct PyMappingAccessrust-analyzer cargo pythonize 0.28.0 de/PyMappingAccess#<'py> { |
| 448 | keysrust-analyzer cargo pythonize 0.28.0 de/PyMappingAccess#keys.: Boundrust-analyzer cargo pyo3 0.28.1 instance/Bound#<'py, PyListrust-analyzer cargo pyo3 0.28.1 types/list/PyList#>, |
| 449 | valuesrust-analyzer cargo pythonize 0.28.0 de/PyMappingAccess#values.: Boundrust-analyzer cargo pyo3 0.28.1 instance/Bound#<'py, PyListrust-analyzer cargo pyo3 0.28.1 types/list/PyList#>, |
| 450 | key_idxrust-analyzer cargo pythonize 0.28.0 de/PyMappingAccess#key_idx.: usize, |
| 451 | val_idxrust-analyzer cargo pythonize 0.28.0 de/PyMappingAccess#val_idx.: usize, |
| 452 | lenrust-analyzer cargo pythonize 0.28.0 de/PyMappingAccess#len.: usize, |
| 453 | } |
| 454 | |
| 455 | impl<'py> PyMappingAccessrust-analyzer cargo pythonize 0.28.0 de/PyMappingAccess#<'py> { |
| 456 | fn newrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyMappingAccess<'py>`]new().(map: &Boundrust-analyzer cargo pyo3 0.28.1 instance/Bound#<'py, PyMappingrust-analyzer cargo pyo3 0.28.1 types/mapping/PyMapping#>) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<Selfrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyMappingAccess<'py>`]> { |
| 457 | let keys = map.keysrust-analyzer cargo pyo3 0.28.1 types/mapping/impl#[`Bound<'py, PyMapping>`][`PyMappingMethods<'py>`]keys().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 458 | let values = map.valuesrust-analyzer cargo pyo3 0.28.1 types/mapping/impl#[`Bound<'py, PyMapping>`][`PyMappingMethods<'py>`]values().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 459 | let len = map.lenrust-analyzer cargo pyo3 0.28.1 types/mapping/impl#[`Bound<'py, PyMapping>`][`PyMappingMethods<'py>`]len().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 460 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyMappingAccess<'py>`] { |
| 461 | keysrust-analyzer cargo pythonize 0.28.0 de/PyMappingAccess#keys., |
| 462 | valuesrust-analyzer cargo pythonize 0.28.0 de/PyMappingAccess#values., |
| 463 | key_idxrust-analyzer cargo pythonize 0.28.0 de/PyMappingAccess#key_idx.: 0, |
| 464 | val_idxrust-analyzer cargo pythonize 0.28.0 de/PyMappingAccess#val_idx.: 0, |
| 465 | lenrust-analyzer cargo pythonize 0.28.0 de/PyMappingAccess#len., |
| 466 | }) |
| 467 | } |
| 468 | } |
| 469 | |
| 470 | impl<'de> derust-analyzer cargo serde_core 1.0.228 de/::MapAccessrust-analyzer cargo serde_core 1.0.228 de/MapAccess#<'de> for PyMappingAccessrust-analyzer cargo pythonize 0.28.0 de/PyMappingAccess#<'_> { |
| 471 | type Errorrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyMappingAccess<'_>`][`MapAccess<'de>`]Error# = PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#; |
| 472 | |
| 473 | fn next_key_seedrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyMappingAccess<'_>`][`MapAccess<'de>`]next_key_seed().<K>(&mut self, seed: K) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<K::Valuerust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#Value#>> |
| 474 | where |
| 475 | K: derust-analyzer cargo serde_core 1.0.228 de/::DeserializeSeedrust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#<'de>, |
| 476 | { |
| 477 | if self.key_idxrust-analyzer cargo pythonize 0.28.0 de/PyMappingAccess#key_idx. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().self.lenrust-analyzer cargo pythonize 0.28.0 de/PyMappingAccess#len. { |
| 478 | let item = self.keysrust-analyzer cargo pythonize 0.28.0 de/PyMappingAccess#keys..get_itemrust-analyzer cargo pyo3 0.28.1 types/list/impl#[`Bound<'py, PyList>`][`PyListMethods<'py>`]get_item().(self.key_idxrust-analyzer cargo pythonize 0.28.0 de/PyMappingAccess#key_idx.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 479 | self.key_idxrust-analyzer cargo pythonize 0.28.0 de/PyMappingAccess#key_idx. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 480 | seed.deserializerust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#deserialize().(&mut Depythonizerrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#::from_objectrust-analyzer cargo pythonize 0.28.0 de/impl#[`Depythonizer<'a, 'py>`]from_object().(&item)) |
| 481 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#) |
| 482 | } else { |
| 483 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) |
| 484 | } |
| 485 | } |
| 486 | |
| 487 | fn next_value_seedrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyMappingAccess<'_>`][`MapAccess<'de>`]next_value_seed().<V>(&mut self, seed: V) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#Value#> |
| 488 | where |
| 489 | V: derust-analyzer cargo serde_core 1.0.228 de/::DeserializeSeedrust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#<'de>, |
| 490 | { |
| 491 | let item = self.valuesrust-analyzer cargo pythonize 0.28.0 de/PyMappingAccess#values..get_itemrust-analyzer cargo pyo3 0.28.1 types/list/impl#[`Bound<'py, PyList>`][`PyListMethods<'py>`]get_item().(self.val_idxrust-analyzer cargo pythonize 0.28.0 de/PyMappingAccess#val_idx.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 492 | self.val_idxrust-analyzer cargo pythonize 0.28.0 de/PyMappingAccess#val_idx. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 493 | seed.deserializerust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#deserialize().(&mut Depythonizerrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#::from_objectrust-analyzer cargo pythonize 0.28.0 de/impl#[`Depythonizer<'a, 'py>`]from_object().(&item)) |
| 494 | } |
| 495 | } |
| 496 | |
| 497 | /// Intermediate structure used to denote that `obj` is a dataclass with `fields`. |
| 498 | struct DataclassCandidaterust-analyzer cargo pythonize 0.28.0 de/DataclassCandidate#<'a, 'py> { |
| 499 | objrust-analyzer cargo pythonize 0.28.0 de/DataclassCandidate#obj.: &'a Boundrust-analyzer cargo pyo3 0.28.1 instance/Bound#<'py, PyAnyrust-analyzer cargo pyo3 0.28.1 types/any/PyAny#>, |
| 500 | fieldsrust-analyzer cargo pythonize 0.28.0 de/DataclassCandidate#fields.: Boundrust-analyzer cargo pyo3 0.28.1 instance/Bound#<'py, PyAnyrust-analyzer cargo pyo3 0.28.1 types/any/PyAny#>, |
| 501 | } |
| 502 | |
| 503 | impl<'a, 'py> DataclassCandidaterust-analyzer cargo pythonize 0.28.0 de/DataclassCandidate#<'a, 'py> { |
| 504 | fn try_newrust-analyzer cargo pythonize 0.28.0 de/impl#[`DataclassCandidate<'a, 'py>`]try_new().(obj: &'a Boundrust-analyzer cargo pyo3 0.28.1 instance/Bound#<'py, PyAnyrust-analyzer cargo pyo3 0.28.1 types/any/PyAny#>) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo pythonize 0.28.0 de/impl#[`DataclassCandidate<'a, 'py>`]> { |
| 505 | let fields = obj |
| 506 | .getattr_optrust-analyzer cargo pyo3 0.28.1 types/any/impl#[`Bound<'py, PyAny>`][`PyAnyMethods<'py>`]getattr_opt().(internrust-analyzer cargo pyo3 0.28.1 sync/intern!!(obj.pyrust-analyzer cargo pyo3 0.28.1 instance/impl#[`Bound<'py, T>`]py().(), "__dataclass_fields__")) |
| 507 | .okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().() |
| 508 | .flattenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<Option<T>>`]flatten().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 509 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Selfrust-analyzer cargo pythonize 0.28.0 de/impl#[`DataclassCandidate<'a, 'py>`] { objrust-analyzer cargo pythonize 0.28.0 de/DataclassCandidate#obj., fieldsrust-analyzer cargo pythonize 0.28.0 de/DataclassCandidate#fields. }) |
| 510 | } |
| 511 | } |
| 512 | |
| 513 | struct PyDataclassAccessrust-analyzer cargo pythonize 0.28.0 de/PyDataclassAccess#<'py> { |
| 514 | fieldsrust-analyzer cargo pythonize 0.28.0 de/PyDataclassAccess#fields.: Boundrust-analyzer cargo pyo3 0.28.1 instance/Bound#<'py, PyListrust-analyzer cargo pyo3 0.28.1 types/list/PyList#>, |
| 515 | dictrust-analyzer cargo pythonize 0.28.0 de/PyDataclassAccess#dict.: Boundrust-analyzer cargo pyo3 0.28.1 instance/Bound#<'py, PyDictrust-analyzer cargo pyo3 0.28.1 types/dict/PyDict#>, |
| 516 | field_idxrust-analyzer cargo pythonize 0.28.0 de/PyDataclassAccess#field_idx.: usize, |
| 517 | val_idxrust-analyzer cargo pythonize 0.28.0 de/PyDataclassAccess#val_idx.: usize, |
| 518 | lenrust-analyzer cargo pythonize 0.28.0 de/PyDataclassAccess#len.: usize, |
| 519 | } |
| 520 | |
| 521 | impl<'py> PyDataclassAccessrust-analyzer cargo pythonize 0.28.0 de/PyDataclassAccess#<'py> { |
| 522 | fn newrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyDataclassAccess<'py>`]new().(dc: DataclassCandidaterust-analyzer cargo pythonize 0.28.0 de/DataclassCandidate#<'_, 'py>) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<Selfrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyDataclassAccess<'py>`]> { |
| 523 | let fields = dc.fieldsrust-analyzer cargo pythonize 0.28.0 de/DataclassCandidate#fields..castrust-analyzer cargo pyo3 0.28.1 instance/impl#[`Bound<'py, T>`]cast().::<PyDictrust-analyzer cargo pyo3 0.28.1 types/dict/PyDict#>()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..keysrust-analyzer cargo pyo3 0.28.1 types/dict/impl#[`Bound<'py, PyDict>`][`PyDictMethods<'py>`]keys().(); |
| 524 | let dict = dc |
| 525 | .objrust-analyzer cargo pythonize 0.28.0 de/DataclassCandidate#obj. |
| 526 | .getattrrust-analyzer cargo pyo3 0.28.1 types/any/impl#[`Bound<'py, PyAny>`][`PyAnyMethods<'py>`]getattr().(internrust-analyzer cargo pyo3 0.28.1 sync/intern!!(dc.objrust-analyzer cargo pythonize 0.28.0 de/DataclassCandidate#obj..pyrust-analyzer cargo pyo3 0.28.1 instance/impl#[`Bound<'py, T>`]py().(), "__dict__"))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 527 | .cast_intorust-analyzer cargo pyo3 0.28.1 instance/impl#[`Bound<'py, T>`]cast_into().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 528 | let len = fields.lenrust-analyzer cargo pyo3 0.28.1 types/list/impl#[`Bound<'py, PyList>`][`PyListMethods<'py>`]len().(); |
| 529 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyDataclassAccess<'py>`] { |
| 530 | fieldsrust-analyzer cargo pythonize 0.28.0 de/PyDataclassAccess#fields., |
| 531 | dictrust-analyzer cargo pythonize 0.28.0 de/PyDataclassAccess#dict., |
| 532 | field_idxrust-analyzer cargo pythonize 0.28.0 de/PyDataclassAccess#field_idx.: 0, |
| 533 | val_idxrust-analyzer cargo pythonize 0.28.0 de/PyDataclassAccess#val_idx.: 0, |
| 534 | lenrust-analyzer cargo pythonize 0.28.0 de/PyDataclassAccess#len., |
| 535 | }) |
| 536 | } |
| 537 | } |
| 538 | |
| 539 | impl<'de> derust-analyzer cargo serde_core 1.0.228 de/::MapAccessrust-analyzer cargo serde_core 1.0.228 de/MapAccess#<'de> for PyDataclassAccessrust-analyzer cargo pythonize 0.28.0 de/PyDataclassAccess#<'_> { |
| 540 | type Errorrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyDataclassAccess<'_>`][`MapAccess<'de>`]Error# = PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#; |
| 541 | |
| 542 | fn next_key_seedrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyDataclassAccess<'_>`][`MapAccess<'de>`]next_key_seed().<K>(&mut self, seed: K) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<K::Valuerust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#Value#>> |
| 543 | where |
| 544 | K: derust-analyzer cargo serde_core 1.0.228 de/::DeserializeSeedrust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#<'de>, |
| 545 | { |
| 546 | if self.field_idxrust-analyzer cargo pythonize 0.28.0 de/PyDataclassAccess#field_idx. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().self.lenrust-analyzer cargo pythonize 0.28.0 de/PyDataclassAccess#len. { |
| 547 | let item = self.fieldsrust-analyzer cargo pythonize 0.28.0 de/PyDataclassAccess#fields..get_itemrust-analyzer cargo pyo3 0.28.1 types/list/impl#[`Bound<'py, PyList>`][`PyListMethods<'py>`]get_item().(self.field_idxrust-analyzer cargo pythonize 0.28.0 de/PyDataclassAccess#field_idx.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 548 | self.field_idxrust-analyzer cargo pythonize 0.28.0 de/PyDataclassAccess#field_idx. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 549 | seed.deserializerust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#deserialize().(&mut Depythonizerrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#::from_objectrust-analyzer cargo pythonize 0.28.0 de/impl#[`Depythonizer<'a, 'py>`]from_object().(&item)) |
| 550 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#) |
| 551 | } else { |
| 552 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) |
| 553 | } |
| 554 | } |
| 555 | |
| 556 | fn next_value_seedrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyDataclassAccess<'_>`][`MapAccess<'de>`]next_value_seed().<V>(&mut self, seed: V) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#Value#> |
| 557 | where |
| 558 | V: derust-analyzer cargo serde_core 1.0.228 de/::DeserializeSeedrust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#<'de>, |
| 559 | { |
| 560 | let key = self.fieldsrust-analyzer cargo pythonize 0.28.0 de/PyDataclassAccess#fields..get_itemrust-analyzer cargo pyo3 0.28.1 types/list/impl#[`Bound<'py, PyList>`][`PyListMethods<'py>`]get_item().(self.val_idxrust-analyzer cargo pythonize 0.28.0 de/PyDataclassAccess#val_idx.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 561 | let value = self |
| 562 | .dictrust-analyzer cargo pythonize 0.28.0 de/PyDataclassAccess#dict. |
| 563 | .get_itemrust-analyzer cargo pyo3 0.28.1 types/dict/impl#[`Bound<'py, PyDict>`][`PyDictMethods<'py>`]get_item().(&key)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). |
| 564 | .ok_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or_else().(|| PyKeyErrorrust-analyzer cargo pyo3 0.28.1 exceptions/PyKeyError#::new_errrust-analyzer cargo pyo3 0.28.1 exceptions/impl#[PyKeyError]new_err().(key.unbindrust-analyzer cargo pyo3 0.28.1 instance/impl#[`Bound<'py, T>`]unbind().()))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 565 | self.val_idxrust-analyzer cargo pythonize 0.28.0 de/PyDataclassAccess#val_idx. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 566 | seed.deserializerust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#deserialize().(&mut Depythonizerrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#::from_objectrust-analyzer cargo pythonize 0.28.0 de/impl#[`Depythonizer<'a, 'py>`]from_object().(&value)) |
| 567 | } |
| 568 | } |
| 569 | |
| 570 | struct PyEnumAccessrust-analyzer cargo pythonize 0.28.0 de/PyEnumAccess#<'a, 'py> { |
| 571 | derust-analyzer cargo pythonize 0.28.0 de/PyEnumAccess#de.: Depythonizerrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#<'a, 'py>, |
| 572 | variantrust-analyzer cargo pythonize 0.28.0 de/PyEnumAccess#variant.: Boundrust-analyzer cargo pyo3 0.28.1 instance/Bound#<'py, PyStringrust-analyzer cargo pyo3 0.28.1 types/string/PyString#>, |
| 573 | } |
| 574 | |
| 575 | impl<'a, 'py> PyEnumAccessrust-analyzer cargo pythonize 0.28.0 de/PyEnumAccess#<'a, 'py> { |
| 576 | fn newrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyEnumAccess<'a, 'py>`]new().(obj: &'a Boundrust-analyzer cargo pyo3 0.28.1 instance/Bound#<'py, PyAnyrust-analyzer cargo pyo3 0.28.1 types/any/PyAny#>, variant: Boundrust-analyzer cargo pyo3 0.28.1 instance/Bound#<'py, PyStringrust-analyzer cargo pyo3 0.28.1 types/string/PyString#>) -> Selfrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyEnumAccess<'a, 'py>`] { |
| 577 | Selfrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyEnumAccess<'a, 'py>`] { |
| 578 | derust-analyzer cargo pythonize 0.28.0 de/PyEnumAccess#de.: Depythonizerrust-analyzer cargo pythonize 0.28.0 de/Depythonizer#::from_objectrust-analyzer cargo pythonize 0.28.0 de/impl#[`Depythonizer<'a, 'py>`]from_object().(obj), |
| 579 | variantrust-analyzer cargo pythonize 0.28.0 de/PyEnumAccess#variant., |
| 580 | } |
| 581 | } |
| 582 | } |
| 583 | |
| 584 | impl<'de> derust-analyzer cargo serde_core 1.0.228 de/::EnumAccessrust-analyzer cargo serde_core 1.0.228 de/EnumAccess#<'de> for PyEnumAccessrust-analyzer cargo pythonize 0.28.0 de/PyEnumAccess#<'_, '_> { |
| 585 | type Errorrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyEnumAccess<'_, '_>`][`EnumAccess<'de>`]Error# = PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#; |
| 586 | type Variantrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyEnumAccess<'_, '_>`][`EnumAccess<'de>`]Variant# = Selfrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyEnumAccess<'_, '_>`][`EnumAccess<'de>`]; |
| 587 | |
| 588 | fn variant_seedrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyEnumAccess<'_, '_>`][`EnumAccess<'de>`]variant_seed().<V>(self, seed: V) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<(V::Valuerust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#Value#, Selfrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyEnumAccess<'_, '_>`][`EnumAccess<'de>`]::Variantrust-analyzer cargo serde_core 1.0.228 de/EnumAccess#Variant#)> |
| 589 | where |
| 590 | V: derust-analyzer cargo serde_core 1.0.228 de/::DeserializeSeedrust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#<'de>, |
| 591 | { |
| 592 | let cow = self.variantrust-analyzer cargo pythonize 0.28.0 de/PyEnumAccess#variant..to_cowrust-analyzer cargo pyo3 0.28.1 types/string/impl#[`Bound<'py, PyString>`][`PyStringMethods<'py>`]to_cow().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 593 | let de: derust-analyzer cargo serde_core 1.0.228 de/::valuerust-analyzer cargo serde_core 1.0.228 de/value/::StrDeserializerrust-analyzer cargo serde_core 1.0.228 de/value/StrDeserializer#<'_, PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#> = cow.as_refrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, T>`][`AsRef<T>`]as_ref().().into_deserializerrust-analyzer cargo serde_core 1.0.228 de/value/impl#[`&'a str`][`IntoDeserializer<'de, E>`]into_deserializer().(); |
| 594 | let val = seed.deserializerust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#deserialize().(de)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 595 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((val, self)) |
| 596 | } |
| 597 | } |
| 598 | |
| 599 | impl<'de> derust-analyzer cargo serde_core 1.0.228 de/::VariantAccessrust-analyzer cargo serde_core 1.0.228 de/VariantAccess#<'de> for PyEnumAccessrust-analyzer cargo pythonize 0.28.0 de/PyEnumAccess#<'_, '_> { |
| 600 | type Errorrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyEnumAccess<'_, '_>`][`VariantAccess<'de>`]Error# = PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#; |
| 601 | |
| 602 | fn unit_variantrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyEnumAccess<'_, '_>`][`VariantAccess<'de>`]unit_variant().(self) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<()> { |
| 603 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 604 | } |
| 605 | |
| 606 | fn newtype_variant_seedrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyEnumAccess<'_, '_>`][`VariantAccess<'de>`]newtype_variant_seed().<T>(self, seed: T) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<T::Valuerust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#Value#> |
| 607 | where |
| 608 | T: derust-analyzer cargo serde_core 1.0.228 de/::DeserializeSeedrust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#<'de>, |
| 609 | { |
| 610 | seed.deserializerust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#deserialize().(&mut { self.derust-analyzer cargo pythonize 0.28.0 de/PyEnumAccess#de. }) |
| 611 | } |
| 612 | |
| 613 | fn tuple_variantrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyEnumAccess<'_, '_>`][`VariantAccess<'de>`]tuple_variant().<V>(self, len: usize, visitor: V) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#> |
| 614 | where |
| 615 | V: derust-analyzer cargo serde_core 1.0.228 de/::Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#<'de>, |
| 616 | { |
| 617 | visitor.visit_seqrust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_seq().(self.derust-analyzer cargo pythonize 0.28.0 de/PyEnumAccess#de..sequence_accessrust-analyzer cargo pythonize 0.28.0 de/impl#[`Depythonizer<'a, 'py>`]sequence_access().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(len))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().) |
| 618 | } |
| 619 | |
| 620 | fn struct_variantrust-analyzer cargo pythonize 0.28.0 de/impl#[`PyEnumAccess<'_, '_>`][`VariantAccess<'de>`]struct_variant().<V>(self, _fields: &'static [&'static str], visitor: V) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#> |
| 621 | where |
| 622 | V: derust-analyzer cargo serde_core 1.0.228 de/::Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#<'de>, |
| 623 | { |
| 624 | visitor.visit_maprust-analyzer cargo serde_core 1.0.228 de/Visitor#visit_map().(self.derust-analyzer cargo pythonize 0.28.0 de/PyEnumAccess#de..dict_accessrust-analyzer cargo pythonize 0.28.0 de/impl#[`Depythonizer<'a, 'py>`]dict_access().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().) |
| 625 | } |
| 626 | } |
| 627 | |
| 628 | // See serde_json |
| 629 | #[cfg(feature = "arbitrary_precision")] |
| 630 | struct NumberDeserializerrust-analyzer cargo pythonize 0.28.0 de/NumberDeserializer# { |
| 631 | numberrust-analyzer cargo pythonize 0.28.0 de/NumberDeserializer#number.: 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#>, |
| 632 | } |
| 633 | |
| 634 | #[cfg(feature = "arbitrary_precision")] |
| 635 | impl<'de> derust-analyzer cargo serde_core 1.0.228 de/::MapAccessrust-analyzer cargo serde_core 1.0.228 de/MapAccess#<'de> for NumberDeserializerrust-analyzer cargo pythonize 0.28.0 de/NumberDeserializer# { |
| 636 | type Errorrust-analyzer cargo pythonize 0.28.0 de/impl#[NumberDeserializer][`MapAccess<'de>`]Error# = PythonizeErrorrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#; |
| 637 | |
| 638 | fn next_key_seedrust-analyzer cargo pythonize 0.28.0 de/impl#[NumberDeserializer][`MapAccess<'de>`]next_key_seed().<K>(&mut self, seed: K) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<K::Valuerust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#Value#>> |
| 639 | where |
| 640 | K: derust-analyzer cargo serde_core 1.0.228 de/::DeserializeSeedrust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#<'de>, |
| 641 | { |
| 642 | if self.numberrust-analyzer cargo pythonize 0.28.0 de/NumberDeserializer#number..is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().() { |
| 643 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 644 | } |
| 645 | seed.deserializerust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#deserialize().(TOKENrust-analyzer cargo pythonize 0.28.0 de/TOKEN..into_deserializerrust-analyzer cargo serde_core 1.0.228 de/value/impl#[`&'a str`][`IntoDeserializer<'de, E>`]into_deserializer().()).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#) |
| 646 | } |
| 647 | |
| 648 | fn next_value_seedrust-analyzer cargo pythonize 0.28.0 de/impl#[NumberDeserializer][`MapAccess<'de>`]next_value_seed().<V>(&mut self, seed: V) -> Resultrust-analyzer cargo pythonize 0.28.0 error/Result#<V::Valuerust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#Value#> |
| 649 | where |
| 650 | V: derust-analyzer cargo serde_core 1.0.228 de/::DeserializeSeedrust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#<'de>, |
| 651 | { |
| 652 | seed.deserializerust-analyzer cargo serde_core 1.0.228 de/DeserializeSeed#deserialize().(self.numberrust-analyzer cargo pythonize 0.28.0 de/NumberDeserializer#number..takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]take().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().into_deserializerrust-analyzer cargo serde_core 1.0.228 de/value/impl#[String][`IntoDeserializer<'de, E>`]into_deserializer().()) |
| 653 | } |
| 654 | } |
| 655 | |
| 656 | #[cfg(test)] |
| 657 | mod testrust-analyzer cargo pythonize 0.28.0 de/test/ { |
| 658 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#, ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::CStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/CStr#}; |
| 659 | |
| 660 | use superrust-analyzer cargo pythonize 0.28.0 de/::*; |
| 661 | use craterust-analyzer cargo pythonize 0.28.0 crate/::errorrust-analyzer cargo pythonize 0.28.0 error/::ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#; |
| 662 | use maplitrust-analyzer cargo maplit 1.0.2 crate/::hashmaprust-analyzer cargo maplit 1.0.2 hashmap!; |
| 663 | use pyo3rust-analyzer cargo pyo3 0.28.1 crate/::{IntoPyObjectrust-analyzer cargo pyo3 0.28.1 conversion/IntoPyObject#, Pythonrust-analyzer cargo pyo3 0.28.1 marker/Python#}; |
| 664 | use serde_jsonrust-analyzer cargo serde_json 1.0.149 crate/::{jsonrust-analyzer cargo serde_json 1.0.149 macros/json!, Valuerust-analyzer cargo serde_json 1.0.149 value/Value# as JsonValuerust-analyzer cargo serde_json 1.0.149 value/Value#}; |
| 665 | |
| 666 | fn test_derust-analyzer cargo pythonize 0.28.0 de/test/test_de().<T>(code: &CStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/CStr#, expected: &T, expected_json: &JsonValuerust-analyzer cargo serde_json 1.0.149 value/Value#) |
| 667 | where |
| 668 | T: derust-analyzer cargo serde_core 1.0.228 de/::DeserializeOwnedrust-analyzer cargo serde_core 1.0.228 de/DeserializeOwned# + PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq# + 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/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#, |
| 669 | { |
| 670 | Pythonrust-analyzer cargo pyo3 0.28.1 marker/Python#::attachrust-analyzer cargo pyo3 0.28.1 marker/impl#[`Python<'_>`]attach().(|py| { |
| 671 | let obj = py.evalrust-analyzer cargo pyo3 0.28.1 marker/impl#[`Python<'py>`]eval().(code, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 672 | test_de_with_objrust-analyzer cargo pythonize 0.28.0 de/test/test_de_with_obj().(&obj, expected, expected_json); |
| 673 | }); |
| 674 | } |
| 675 | |
| 676 | fn test_de_with_objrust-analyzer cargo pythonize 0.28.0 de/test/test_de_with_obj().<T>(obj: &Boundrust-analyzer cargo pyo3 0.28.1 instance/Bound#<'_, PyAnyrust-analyzer cargo pyo3 0.28.1 types/any/PyAny#>, expected: &T, expected_json: &JsonValuerust-analyzer cargo serde_json 1.0.149 value/Value#) |
| 677 | where |
| 678 | T: derust-analyzer cargo serde_core 1.0.228 de/::DeserializeOwnedrust-analyzer cargo serde_core 1.0.228 de/DeserializeOwned# + PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq# + 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/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#, |
| 679 | { |
| 680 | let actual: T = depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().(obj).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 681 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&actual, expected); |
| 682 | |
| 683 | let actual_json: JsonValuerust-analyzer cargo serde_json 1.0.149 value/Value# = depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().(obj).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 684 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&actual_json, expected_json); |
| 685 | } |
| 686 | |
| 687 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 688 | fn test_empty_structrust-analyzer cargo pythonize 0.28.0 de/test/test_empty_struct().() { |
| 689 | #[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:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 690 | struct Emptyrust-analyzer cargo pythonize 0.28.0 de/test/Empty#; |
| 691 | |
| 692 | let expected = Emptyrust-analyzer cargo pythonize 0.28.0 de/test/Empty#; |
| 693 | let expected_json = jsonrust-analyzer cargo serde_json 1.0.149 macros/json!!(null); |
| 694 | let code = c"None"; |
| 695 | test_derust-analyzer cargo pythonize 0.28.0 de/test/test_de().(code, &expected, &expected_json); |
| 696 | } |
| 697 | |
| 698 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 699 | fn test_structrust-analyzer cargo pythonize 0.28.0 de/test/test_struct().() { |
| 700 | #[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:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 701 | struct Structrust-analyzer cargo pythonize 0.28.0 de/test/Struct# { |
| 702 | foorust-analyzer cargo pythonize 0.28.0 de/test/Struct#foo.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, |
| 703 | barrust-analyzer cargo pythonize 0.28.0 de/test/Struct#bar.: usize, |
| 704 | bazrust-analyzer cargo pythonize 0.28.0 de/test/Struct#baz.: f32, |
| 705 | quxrust-analyzer cargo pythonize 0.28.0 de/test/Struct#qux.: bool, |
| 706 | } |
| 707 | |
| 708 | let expected = Structrust-analyzer cargo pythonize 0.28.0 de/test/Struct# { |
| 709 | foorust-analyzer cargo pythonize 0.28.0 de/test/Struct#foo.: "Foo".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), |
| 710 | barrust-analyzer cargo pythonize 0.28.0 de/test/Struct#bar.: 8usize, |
| 711 | bazrust-analyzer cargo pythonize 0.28.0 de/test/Struct#baz.: 45.23, |
| 712 | quxrust-analyzer cargo pythonize 0.28.0 de/test/Struct#qux.: true, |
| 713 | }; |
| 714 | let expected_json = jsonrust-analyzer cargo serde_json 1.0.149 macros/json!!({ |
| 715 | "foo": "Foo", |
| 716 | "bar": 8, |
| 717 | "baz": 45.23, |
| 718 | "qux": true |
| 719 | }); |
| 720 | let code = c"{'foo': 'Foo', 'bar': 8, 'baz': 45.23, 'qux': True}"; |
| 721 | test_derust-analyzer cargo pythonize 0.28.0 de/test/test_de().(code, &expected, &expected_json); |
| 722 | } |
| 723 | |
| 724 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 725 | fn test_struct_missing_keyrust-analyzer cargo pythonize 0.28.0 de/test/test_struct_missing_key().() { |
| 726 | #[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:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 727 | struct Structrust-analyzer cargo pythonize 0.28.0 de/test/Struct# { |
| 728 | foorust-analyzer cargo pythonize 0.28.0 de/test/Struct#foo.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, |
| 729 | barrust-analyzer cargo pythonize 0.28.0 de/test/Struct#bar.: usize, |
| 730 | } |
| 731 | |
| 732 | let code = c"{'foo': 'Foo'}"; |
| 733 | |
| 734 | Pythonrust-analyzer cargo pyo3 0.28.1 marker/Python#::attachrust-analyzer cargo pyo3 0.28.1 marker/impl#[`Python<'_>`]attach().(|py| { |
| 735 | let locals = PyDictrust-analyzer cargo pyo3 0.28.1 types/dict/PyDict#::newrust-analyzer cargo pyo3 0.28.1 types/dict/impl#[PyDict]new().(py); |
| 736 | let obj = py.evalrust-analyzer cargo pyo3 0.28.1 marker/impl#[`Python<'py>`]eval().(code, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&locals)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 737 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!( |
| 738 | *rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T, A>`][Deref]deref().depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().::<Structrust-analyzer cargo pythonize 0.28.0 de/test/Struct#>(&obj).unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().().innerrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#inner., |
| 739 | ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::Messagerust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#Message#(msg) if msg == "missing field `bar`" |
| 740 | )); |
| 741 | }) |
| 742 | } |
| 743 | |
| 744 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 745 | fn test_tuple_structrust-analyzer cargo pythonize 0.28.0 de/test/test_tuple_struct().() { |
| 746 | #[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:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 747 | struct TupleStructrust-analyzer cargo pythonize 0.28.0 de/test/TupleStruct#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, f64); |
| 748 | |
| 749 | let expected = TupleStructrust-analyzer cargo pythonize 0.28.0 de/test/TupleStruct#("cat".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().10.05); |
| 750 | let expected_json = jsonrust-analyzer cargo serde_json 1.0.149 macros/json!!(["cat", -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().10.05]); |
| 751 | let code = c"('cat', -10.05)"; |
| 752 | test_derust-analyzer cargo pythonize 0.28.0 de/test/test_de().(code, &expected, &expected_json); |
| 753 | } |
| 754 | |
| 755 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 756 | fn test_tuple_too_longrust-analyzer cargo pythonize 0.28.0 de/test/test_tuple_too_long().() { |
| 757 | #[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:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 758 | struct TupleStructrust-analyzer cargo pythonize 0.28.0 de/test/TupleStruct#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, f64); |
| 759 | |
| 760 | let code = c"('cat', -10.05, 'foo')"; |
| 761 | |
| 762 | Pythonrust-analyzer cargo pyo3 0.28.1 marker/Python#::attachrust-analyzer cargo pyo3 0.28.1 marker/impl#[`Python<'_>`]attach().(|py| { |
| 763 | let locals = PyDictrust-analyzer cargo pyo3 0.28.1 types/dict/PyDict#::newrust-analyzer cargo pyo3 0.28.1 types/dict/impl#[PyDict]new().(py); |
| 764 | let obj = py.evalrust-analyzer cargo pyo3 0.28.1 marker/impl#[`Python<'py>`]eval().(code, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&locals)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 765 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!( |
| 766 | *rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T, A>`][Deref]deref().depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().::<TupleStructrust-analyzer cargo pythonize 0.28.0 de/test/TupleStruct#>(&obj).unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().().innerrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#inner., |
| 767 | 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. } if expected == 2 && got == 3 |
| 768 | )); |
| 769 | }) |
| 770 | } |
| 771 | |
| 772 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 773 | fn test_tuple_struct_from_pylistrust-analyzer cargo pythonize 0.28.0 de/test/test_tuple_struct_from_pylist().() { |
| 774 | #[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:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 775 | struct TupleStructrust-analyzer cargo pythonize 0.28.0 de/test/TupleStruct#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, f64); |
| 776 | |
| 777 | let expected = TupleStructrust-analyzer cargo pythonize 0.28.0 de/test/TupleStruct#("cat".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().10.05); |
| 778 | let expected_json = jsonrust-analyzer cargo serde_json 1.0.149 macros/json!!(["cat", -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().10.05]); |
| 779 | let code = c"['cat', -10.05]"; |
| 780 | test_derust-analyzer cargo pythonize 0.28.0 de/test/test_de().(code, &expected, &expected_json); |
| 781 | } |
| 782 | |
| 783 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 784 | fn test_tuplerust-analyzer cargo pythonize 0.28.0 de/test/test_tuple().() { |
| 785 | let expected = ("foo".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), 5); |
| 786 | let expected_json = jsonrust-analyzer cargo serde_json 1.0.149 macros/json!!(["foo", 5]); |
| 787 | let code = c"('foo', 5)"; |
| 788 | test_derust-analyzer cargo pythonize 0.28.0 de/test/test_de().(code, &expected, &expected_json); |
| 789 | } |
| 790 | |
| 791 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 792 | fn test_tuple_from_pylistrust-analyzer cargo pythonize 0.28.0 de/test/test_tuple_from_pylist().() { |
| 793 | let expected = ("foo".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), 5); |
| 794 | let expected_json = jsonrust-analyzer cargo serde_json 1.0.149 macros/json!!(["foo", 5]); |
| 795 | let code = c"['foo', 5]"; |
| 796 | test_derust-analyzer cargo pythonize 0.28.0 de/test/test_de().(code, &expected, &expected_json); |
| 797 | } |
| 798 | |
| 799 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 800 | fn test_vec_from_pysetrust-analyzer cargo pythonize 0.28.0 de/test/test_vec_from_pyset().() { |
| 801 | let expected = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["foo".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()]; |
| 802 | let expected_json = jsonrust-analyzer cargo serde_json 1.0.149 macros/json!!(["foo"]); |
| 803 | let code = c"{'foo'}"; |
| 804 | test_derust-analyzer cargo pythonize 0.28.0 de/test/test_de().(code, &expected, &expected_json); |
| 805 | } |
| 806 | |
| 807 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 808 | fn test_vec_from_pyfrozensetrust-analyzer cargo pythonize 0.28.0 de/test/test_vec_from_pyfrozenset().() { |
| 809 | let expected = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["foo".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()]; |
| 810 | let expected_json = jsonrust-analyzer cargo serde_json 1.0.149 macros/json!!(["foo"]); |
| 811 | let code = c"frozenset({'foo'})"; |
| 812 | test_derust-analyzer cargo pythonize 0.28.0 de/test/test_de().(code, &expected, &expected_json); |
| 813 | } |
| 814 | |
| 815 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 816 | fn test_vecrust-analyzer cargo pythonize 0.28.0 de/test/test_vec().() { |
| 817 | let expected = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![3, 2, 1]; |
| 818 | let expected_json = jsonrust-analyzer cargo serde_json 1.0.149 macros/json!!([3, 2, 1]); |
| 819 | let code = c"[3, 2, 1]"; |
| 820 | test_derust-analyzer cargo pythonize 0.28.0 de/test/test_de().(code, &expected, &expected_json); |
| 821 | } |
| 822 | |
| 823 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 824 | fn test_vec_from_tuplerust-analyzer cargo pythonize 0.28.0 de/test/test_vec_from_tuple().() { |
| 825 | let expected = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![3, 2, 1]; |
| 826 | let expected_json = jsonrust-analyzer cargo serde_json 1.0.149 macros/json!!([3, 2, 1]); |
| 827 | let code = c"(3, 2, 1)"; |
| 828 | test_derust-analyzer cargo pythonize 0.28.0 de/test/test_de().(code, &expected, &expected_json); |
| 829 | } |
| 830 | |
| 831 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 832 | fn test_hashmaprust-analyzer cargo pythonize 0.28.0 de/test/test_hashmap().() { |
| 833 | let expected = hashmaprust-analyzer cargo maplit 1.0.2 hashmap!! {"foo".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().() => 4}; |
| 834 | let expected_json = jsonrust-analyzer cargo serde_json 1.0.149 macros/json!!({"foo": 4 }); |
| 835 | let code = c"{'foo': 4}"; |
| 836 | test_derust-analyzer cargo pythonize 0.28.0 de/test/test_de().(code, &expected, &expected_json); |
| 837 | } |
| 838 | |
| 839 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 840 | fn test_enum_variantrust-analyzer cargo pythonize 0.28.0 de/test/test_enum_variant().() { |
| 841 | #[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:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 842 | enum Foorust-analyzer cargo pythonize 0.28.0 de/test/Foo# { |
| 843 | Variantrust-analyzer cargo pythonize 0.28.0 de/test/Foo#Variant#, |
| 844 | } |
| 845 | |
| 846 | let expected = Foorust-analyzer cargo pythonize 0.28.0 de/test/Foo#::Variantrust-analyzer cargo pythonize 0.28.0 de/test/Foo#Variant#; |
| 847 | let expected_json = jsonrust-analyzer cargo serde_json 1.0.149 macros/json!!("Variant"); |
| 848 | let code = c"'Variant'"; |
| 849 | test_derust-analyzer cargo pythonize 0.28.0 de/test/test_de().(code, &expected, &expected_json); |
| 850 | } |
| 851 | |
| 852 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 853 | fn test_enum_tuple_variantrust-analyzer cargo pythonize 0.28.0 de/test/test_enum_tuple_variant().() { |
| 854 | #[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:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 855 | enum Foorust-analyzer cargo pythonize 0.28.0 de/test/Foo# { |
| 856 | Tuplerust-analyzer cargo pythonize 0.28.0 de/test/Foo#Tuple#(i32, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 857 | } |
| 858 | |
| 859 | let expected = Foorust-analyzer cargo pythonize 0.28.0 de/test/Foo#::Tuplerust-analyzer cargo pythonize 0.28.0 de/test/Foo#Tuple#(12, "cat".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 860 | let expected_json = jsonrust-analyzer cargo serde_json 1.0.149 macros/json!!({"Tuple": [12, "cat"]}); |
| 861 | let code = c"{'Tuple': [12, 'cat']}"; |
| 862 | test_derust-analyzer cargo pythonize 0.28.0 de/test/test_de().(code, &expected, &expected_json); |
| 863 | } |
| 864 | |
| 865 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 866 | fn test_enum_newtype_variantrust-analyzer cargo pythonize 0.28.0 de/test/test_enum_newtype_variant().() { |
| 867 | #[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:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 868 | enum Foorust-analyzer cargo pythonize 0.28.0 de/test/Foo# { |
| 869 | NewTyperust-analyzer cargo pythonize 0.28.0 de/test/Foo#NewType#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 870 | } |
| 871 | |
| 872 | let expected = Foorust-analyzer cargo pythonize 0.28.0 de/test/Foo#::NewTyperust-analyzer cargo pythonize 0.28.0 de/test/Foo#NewType#("cat".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 873 | let expected_json = jsonrust-analyzer cargo serde_json 1.0.149 macros/json!!({"NewType": "cat" }); |
| 874 | let code = c"{'NewType': 'cat'}"; |
| 875 | test_derust-analyzer cargo pythonize 0.28.0 de/test/test_de().(code, &expected, &expected_json); |
| 876 | } |
| 877 | |
| 878 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 879 | fn test_enum_struct_variantrust-analyzer cargo pythonize 0.28.0 de/test/test_enum_struct_variant().() { |
| 880 | #[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:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 881 | enum Foorust-analyzer cargo pythonize 0.28.0 de/test/Foo# { |
| 882 | Structrust-analyzer cargo pythonize 0.28.0 de/test/Foo#Struct# { foorust-analyzer cargo pythonize 0.28.0 de/test/Foo#Struct#foo.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, barrust-analyzer cargo pythonize 0.28.0 de/test/Foo#Struct#bar.: usize }, |
| 883 | } |
| 884 | |
| 885 | let expected = Foorust-analyzer cargo pythonize 0.28.0 de/test/Foo#::Structrust-analyzer cargo pythonize 0.28.0 de/test/Foo#Struct# { |
| 886 | foorust-analyzer cargo pythonize 0.28.0 de/test/Foo#Struct#foo.: "cat".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), |
| 887 | barrust-analyzer cargo pythonize 0.28.0 de/test/Foo#Struct#bar.: 25, |
| 888 | }; |
| 889 | let expected_json = jsonrust-analyzer cargo serde_json 1.0.149 macros/json!!({"Struct": {"foo": "cat", "bar": 25 }}); |
| 890 | let code = c"{'Struct': {'foo': 'cat', 'bar': 25}}"; |
| 891 | test_derust-analyzer cargo pythonize 0.28.0 de/test/test_de().(code, &expected, &expected_json); |
| 892 | } |
| 893 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 894 | fn test_enum_untagged_tuple_variantrust-analyzer cargo pythonize 0.28.0 de/test/test_enum_untagged_tuple_variant().() { |
| 895 | #[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:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 896 | #[serde(untagged)] |
| 897 | enum Foorust-analyzer cargo pythonize 0.28.0 de/test/Foo# { |
| 898 | Tuplerust-analyzer cargo pythonize 0.28.0 de/test/Foo#Tuple#(f32, char), |
| 899 | } |
| 900 | |
| 901 | let expected = Foorust-analyzer cargo pythonize 0.28.0 de/test/Foo#::Tuplerust-analyzer cargo pythonize 0.28.0 de/test/Foo#Tuple#(12.0, 'c'); |
| 902 | let expected_json = jsonrust-analyzer cargo serde_json 1.0.149 macros/json!!([12.0, 'c']); |
| 903 | let code = c"[12.0, 'c']"; |
| 904 | test_derust-analyzer cargo pythonize 0.28.0 de/test/test_de().(code, &expected, &expected_json); |
| 905 | } |
| 906 | |
| 907 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 908 | fn test_enum_untagged_newtype_variantrust-analyzer cargo pythonize 0.28.0 de/test/test_enum_untagged_newtype_variant().() { |
| 909 | #[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:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 910 | #[serde(untagged)] |
| 911 | enum Foorust-analyzer cargo pythonize 0.28.0 de/test/Foo# { |
| 912 | NewTyperust-analyzer cargo pythonize 0.28.0 de/test/Foo#NewType#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 913 | } |
| 914 | |
| 915 | let expected = Foorust-analyzer cargo pythonize 0.28.0 de/test/Foo#::NewTyperust-analyzer cargo pythonize 0.28.0 de/test/Foo#NewType#("cat".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 916 | let expected_json = jsonrust-analyzer cargo serde_json 1.0.149 macros/json!!("cat"); |
| 917 | let code = c"'cat'"; |
| 918 | test_derust-analyzer cargo pythonize 0.28.0 de/test/test_de().(code, &expected, &expected_json); |
| 919 | } |
| 920 | |
| 921 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 922 | fn test_enum_untagged_struct_variantrust-analyzer cargo pythonize 0.28.0 de/test/test_enum_untagged_struct_variant().() { |
| 923 | #[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:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 924 | #[serde(untagged)] |
| 925 | enum Foorust-analyzer cargo pythonize 0.28.0 de/test/Foo# { |
| 926 | Structrust-analyzer cargo pythonize 0.28.0 de/test/Foo#Struct# { foorust-analyzer cargo pythonize 0.28.0 de/test/Foo#Struct#foo.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<char>, barrust-analyzer cargo pythonize 0.28.0 de/test/Foo#Struct#bar.: [u8; 4] }, |
| 927 | } |
| 928 | |
| 929 | let expected = Foorust-analyzer cargo pythonize 0.28.0 de/test/Foo#::Structrust-analyzer cargo pythonize 0.28.0 de/test/Foo#Struct# { |
| 930 | foorust-analyzer cargo pythonize 0.28.0 de/test/Foo#Struct#foo.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!['a', 'b', 'c'], |
| 931 | barrust-analyzer cargo pythonize 0.28.0 de/test/Foo#Struct#bar.: [2, 5, 3, 1], |
| 932 | }; |
| 933 | let expected_json = jsonrust-analyzer cargo serde_json 1.0.149 macros/json!!({"foo": ["a", "b", "c"], "bar": [2, 5, 3, 1]}); |
| 934 | let code = c"{'foo': ['a', 'b', 'c'], 'bar': [2, 5, 3, 1]}"; |
| 935 | test_derust-analyzer cargo pythonize 0.28.0 de/test/test_de().(code, &expected, &expected_json); |
| 936 | } |
| 937 | |
| 938 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 939 | fn test_nested_typerust-analyzer cargo pythonize 0.28.0 de/test/test_nested_type().() { |
| 940 | #[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:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 941 | struct Foorust-analyzer cargo pythonize 0.28.0 de/test/Foo# { |
| 942 | namerust-analyzer cargo pythonize 0.28.0 de/test/Foo#name.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, |
| 943 | barrust-analyzer cargo pythonize 0.28.0 de/test/Foo#bar.: Barrust-analyzer cargo pythonize 0.28.0 de/test/Bar#, |
| 944 | } |
| 945 | |
| 946 | #[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:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 947 | struct Barrust-analyzer cargo pythonize 0.28.0 de/test/Bar# { |
| 948 | valuerust-analyzer cargo pythonize 0.28.0 de/test/Bar#value.: usize, |
| 949 | variantrust-analyzer cargo pythonize 0.28.0 de/test/Bar#variant.: Bazrust-analyzer cargo pythonize 0.28.0 de/test/Baz#, |
| 950 | } |
| 951 | |
| 952 | #[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:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 953 | enum Bazrust-analyzer cargo pythonize 0.28.0 de/test/Baz# { |
| 954 | Basicrust-analyzer cargo pythonize 0.28.0 de/test/Baz#Basic#, |
| 955 | Tuplerust-analyzer cargo pythonize 0.28.0 de/test/Baz#Tuple#(f32, u32), |
| 956 | } |
| 957 | |
| 958 | let expected = Foorust-analyzer cargo pythonize 0.28.0 de/test/Foo# { |
| 959 | namerust-analyzer cargo pythonize 0.28.0 de/test/Foo#name.: "SomeFoo".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), |
| 960 | barrust-analyzer cargo pythonize 0.28.0 de/test/Foo#bar.: Barrust-analyzer cargo pythonize 0.28.0 de/test/Bar# { |
| 961 | valuerust-analyzer cargo pythonize 0.28.0 de/test/Bar#value.: 13, |
| 962 | variantrust-analyzer cargo pythonize 0.28.0 de/test/Bar#variant.: Bazrust-analyzer cargo pythonize 0.28.0 de/test/Baz#::Tuplerust-analyzer cargo pythonize 0.28.0 de/test/Baz#Tuple#(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().1.5, 8), |
| 963 | }, |
| 964 | }; |
| 965 | let expected_json = |
| 966 | jsonrust-analyzer cargo serde_json 1.0.149 macros/json!!({"name": "SomeFoo", "bar": { "value": 13, "variant": { "Tuple": [-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().1.5, 8]}}}); |
| 967 | let code = c"{'name': 'SomeFoo', 'bar': {'value': 13, 'variant': {'Tuple': [-1.5, 8]}}}"; |
| 968 | test_derust-analyzer cargo pythonize 0.28.0 de/test/test_de().(code, &expected, &expected_json); |
| 969 | } |
| 970 | |
| 971 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 972 | fn test_int_limitsrust-analyzer cargo pythonize 0.28.0 de/test/test_int_limits().() { |
| 973 | Pythonrust-analyzer cargo pyo3 0.28.1 marker/Python#::attachrust-analyzer cargo pyo3 0.28.1 marker/impl#[`Python<'_>`]attach().(|py| { |
| 974 | // serde_json::Value supports u64 and i64 as maximum sizes |
| 975 | let _: serde_jsonrust-analyzer cargo serde_json 1.0.149 crate/::Valuerust-analyzer cargo serde_json 1.0.149 value/Value# = depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().(&u8::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]MAX..into_pyobjectrust-analyzer cargo pyo3 0.28.1 conversions/std/num/impl#[u8][`IntoPyObject<'py>`]into_pyobject().(py).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 976 | let _: serde_jsonrust-analyzer cargo serde_json 1.0.149 crate/::Valuerust-analyzer cargo serde_json 1.0.149 value/Value# = depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().(&u8::MINrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u8]MIN..into_pyobjectrust-analyzer cargo pyo3 0.28.1 conversions/std/num/impl#[u8][`IntoPyObject<'py>`]into_pyobject().(py).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 977 | let _: serde_jsonrust-analyzer cargo serde_json 1.0.149 crate/::Valuerust-analyzer cargo serde_json 1.0.149 value/Value# = depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().(&i8::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i8]MAX..into_pyobjectrust-analyzer cargo pyo3 0.28.1 conversions/std/num/impl#[i8][`IntoPyObject<'py>`]into_pyobject().(py).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 978 | let _: serde_jsonrust-analyzer cargo serde_json 1.0.149 crate/::Valuerust-analyzer cargo serde_json 1.0.149 value/Value# = depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().(&i8::MINrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i8]MIN..into_pyobjectrust-analyzer cargo pyo3 0.28.1 conversions/std/num/impl#[i8][`IntoPyObject<'py>`]into_pyobject().(py).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 979 | |
| 980 | let _: serde_jsonrust-analyzer cargo serde_json 1.0.149 crate/::Valuerust-analyzer cargo serde_json 1.0.149 value/Value# = depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().(&u16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MAX..into_pyobjectrust-analyzer cargo pyo3 0.28.1 conversions/std/num/impl#[u16][`IntoPyObject<'py>`]into_pyobject().(py).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 981 | let _: serde_jsonrust-analyzer cargo serde_json 1.0.149 crate/::Valuerust-analyzer cargo serde_json 1.0.149 value/Value# = depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().(&u16::MINrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16]MIN..into_pyobjectrust-analyzer cargo pyo3 0.28.1 conversions/std/num/impl#[u16][`IntoPyObject<'py>`]into_pyobject().(py).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 982 | let _: serde_jsonrust-analyzer cargo serde_json 1.0.149 crate/::Valuerust-analyzer cargo serde_json 1.0.149 value/Value# = depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().(&i16::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i16]MAX..into_pyobjectrust-analyzer cargo pyo3 0.28.1 conversions/std/num/impl#[i16][`IntoPyObject<'py>`]into_pyobject().(py).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 983 | let _: serde_jsonrust-analyzer cargo serde_json 1.0.149 crate/::Valuerust-analyzer cargo serde_json 1.0.149 value/Value# = depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().(&i16::MINrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i16]MIN..into_pyobjectrust-analyzer cargo pyo3 0.28.1 conversions/std/num/impl#[i16][`IntoPyObject<'py>`]into_pyobject().(py).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 984 | |
| 985 | let _: serde_jsonrust-analyzer cargo serde_json 1.0.149 crate/::Valuerust-analyzer cargo serde_json 1.0.149 value/Value# = depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().(&u32::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]MAX..into_pyobjectrust-analyzer cargo pyo3 0.28.1 conversions/std/num/impl#[u32][`IntoPyObject<'py>`]into_pyobject().(py).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 986 | let _: serde_jsonrust-analyzer cargo serde_json 1.0.149 crate/::Valuerust-analyzer cargo serde_json 1.0.149 value/Value# = depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().(&u32::MINrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]MIN..into_pyobjectrust-analyzer cargo pyo3 0.28.1 conversions/std/num/impl#[u32][`IntoPyObject<'py>`]into_pyobject().(py).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 987 | let _: serde_jsonrust-analyzer cargo serde_json 1.0.149 crate/::Valuerust-analyzer cargo serde_json 1.0.149 value/Value# = depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().(&i32::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]MAX..into_pyobjectrust-analyzer cargo pyo3 0.28.1 conversions/std/num/impl#[i32][`IntoPyObject<'py>`]into_pyobject().(py).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 988 | let _: serde_jsonrust-analyzer cargo serde_json 1.0.149 crate/::Valuerust-analyzer cargo serde_json 1.0.149 value/Value# = depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().(&i32::MINrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i32]MIN..into_pyobjectrust-analyzer cargo pyo3 0.28.1 conversions/std/num/impl#[i32][`IntoPyObject<'py>`]into_pyobject().(py).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 989 | |
| 990 | let _: serde_jsonrust-analyzer cargo serde_json 1.0.149 crate/::Valuerust-analyzer cargo serde_json 1.0.149 value/Value# = depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().(&u64::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u64]MAX..into_pyobjectrust-analyzer cargo pyo3 0.28.1 conversions/std/num/impl#[u64][`IntoPyObject<'py>`]into_pyobject().(py).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 991 | let _: serde_jsonrust-analyzer cargo serde_json 1.0.149 crate/::Valuerust-analyzer cargo serde_json 1.0.149 value/Value# = depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().(&u64::MINrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u64]MIN..into_pyobjectrust-analyzer cargo pyo3 0.28.1 conversions/std/num/impl#[u64][`IntoPyObject<'py>`]into_pyobject().(py).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 992 | let _: serde_jsonrust-analyzer cargo serde_json 1.0.149 crate/::Valuerust-analyzer cargo serde_json 1.0.149 value/Value# = depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().(&i64::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i64]MAX..into_pyobjectrust-analyzer cargo pyo3 0.28.1 conversions/std/num/impl#[i64][`IntoPyObject<'py>`]into_pyobject().(py).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 993 | let _: serde_jsonrust-analyzer cargo serde_json 1.0.149 crate/::Valuerust-analyzer cargo serde_json 1.0.149 value/Value# = depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().(&i64::MINrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i64]MIN..into_pyobjectrust-analyzer cargo pyo3 0.28.1 conversions/std/num/impl#[i64][`IntoPyObject<'py>`]into_pyobject().(py).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 994 | |
| 995 | let _: u128 = depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().(&u128::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u128]MAX..into_pyobjectrust-analyzer cargo pyo3 0.28.1 conversions/std/num/fast_128bit_int_conversion/impl#[u128][`IntoPyObject<'py>`]into_pyobject().(py).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 996 | let _: i128 = depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().(&u128::MINrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u128]MIN..into_pyobjectrust-analyzer cargo pyo3 0.28.1 conversions/std/num/fast_128bit_int_conversion/impl#[u128][`IntoPyObject<'py>`]into_pyobject().(py).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 997 | |
| 998 | let _: i128 = depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().(&i128::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i128]MAX..into_pyobjectrust-analyzer cargo pyo3 0.28.1 conversions/std/num/fast_128bit_int_conversion/impl#[i128][`IntoPyObject<'py>`]into_pyobject().(py).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 999 | let _: i128 = depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().(&i128::MINrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i128]MIN..into_pyobjectrust-analyzer cargo pyo3 0.28.1 conversions/std/num/fast_128bit_int_conversion/impl#[i128][`IntoPyObject<'py>`]into_pyobject().(py).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 1000 | }); |
| 1001 | } |
| 1002 | |
| 1003 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1004 | fn test_deserialize_bytesrust-analyzer cargo pythonize 0.28.0 de/test/test_deserialize_bytes().() { |
| 1005 | Pythonrust-analyzer cargo pyo3 0.28.1 marker/Python#::attachrust-analyzer cargo pyo3 0.28.1 marker/impl#[`Python<'_>`]attach().(|py| { |
| 1006 | let obj = PyBytesrust-analyzer cargo pyo3 0.28.1 types/bytes/PyBytes#::newrust-analyzer cargo pyo3 0.28.1 types/bytes/impl#[PyBytes]new().(py, "hello".as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()); |
| 1007 | let actual: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().(&obj).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 1008 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(actual, b"hello"); |
| 1009 | }) |
| 1010 | } |
| 1011 | |
| 1012 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1013 | fn test_charrust-analyzer cargo pythonize 0.28.0 de/test/test_char().() { |
| 1014 | let expected = 'a'; |
| 1015 | let expected_json = jsonrust-analyzer cargo serde_json 1.0.149 macros/json!!("a"); |
| 1016 | let code = c"'a'"; |
| 1017 | test_derust-analyzer cargo pythonize 0.28.0 de/test/test_de().(code, &expected, &expected_json); |
| 1018 | } |
| 1019 | |
| 1020 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1021 | fn test_unknown_typerust-analyzer cargo pythonize 0.28.0 de/test/test_unknown_type().() { |
| 1022 | Pythonrust-analyzer cargo pyo3 0.28.1 marker/Python#::attachrust-analyzer cargo pyo3 0.28.1 marker/impl#[`Python<'_>`]attach().(|py| { |
| 1023 | let obj = py |
| 1024 | .importrust-analyzer cargo pyo3 0.28.1 marker/impl#[`Python<'py>`]import().("decimal") |
| 1025 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().() |
| 1026 | .getattrrust-analyzer cargo pyo3 0.28.1 types/any/impl#[`Bound<'py, PyAny>`][`PyAnyMethods<'py>`]getattr().("Decimal") |
| 1027 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().() |
| 1028 | .call0rust-analyzer cargo pyo3 0.28.1 types/any/impl#[`Bound<'py, PyAny>`][`PyAnyMethods<'py>`]call0().() |
| 1029 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 1030 | let err = depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().::<serde_jsonrust-analyzer cargo serde_json 1.0.149 crate/::Valuerust-analyzer cargo serde_json 1.0.149 value/Value#>(&obj).unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().(); |
| 1031 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!( |
| 1032 | *rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T, A>`][Deref]deref().err.innerrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#inner., |
| 1033 | ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::UnsupportedTyperust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#UnsupportedType#(name) if name == "Decimal" |
| 1034 | )); |
| 1035 | }); |
| 1036 | } |
| 1037 | |
| 1038 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1039 | fn test_dataclassrust-analyzer cargo pythonize 0.28.0 de/test/test_dataclass().() { |
| 1040 | let code = c"\ |
| 1041 | from dataclasses import dataclass |
| 1042 | |
| 1043 | @dataclass |
| 1044 | class Point: |
| 1045 | x: int |
| 1046 | y: int |
| 1047 | |
| 1048 | point = Point(1, 2)"; |
| 1049 | |
| 1050 | #[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:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 1051 | struct Pointrust-analyzer cargo pythonize 0.28.0 de/test/Point# { |
| 1052 | xrust-analyzer cargo pythonize 0.28.0 de/test/Point#x.: i32, |
| 1053 | yrust-analyzer cargo pythonize 0.28.0 de/test/Point#y.: i32, |
| 1054 | } |
| 1055 | |
| 1056 | let expected = Pointrust-analyzer cargo pythonize 0.28.0 de/test/Point# { xrust-analyzer cargo pythonize 0.28.0 de/test/Point#x.: 1, yrust-analyzer cargo pythonize 0.28.0 de/test/Point#y.: 2 }; |
| 1057 | let expected_json = jsonrust-analyzer cargo serde_json 1.0.149 macros/json!!({"x": 1, "y": 2}); |
| 1058 | |
| 1059 | Pythonrust-analyzer cargo pyo3 0.28.1 marker/Python#::attachrust-analyzer cargo pyo3 0.28.1 marker/impl#[`Python<'_>`]attach().(|py| { |
| 1060 | let locals = PyDictrust-analyzer cargo pyo3 0.28.1 types/dict/PyDict#::newrust-analyzer cargo pyo3 0.28.1 types/dict/impl#[PyDict]new().(py); |
| 1061 | py.runrust-analyzer cargo pyo3 0.28.1 marker/impl#[`Python<'py>`]run().(code, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&locals)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 1062 | let obj = locals.get_itemrust-analyzer cargo pyo3 0.28.1 types/dict/impl#[`Bound<'py, PyDict>`][`PyDictMethods<'py>`]get_item().("point").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 1063 | test_de_with_objrust-analyzer cargo pythonize 0.28.0 de/test/test_de_with_obj().(&obj, &expected, &expected_json); |
| 1064 | |
| 1065 | let map: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, i32> = depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().(&obj).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 1066 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(map.lenrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]len().(), 2); |
| 1067 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().map.getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().("x").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 1); |
| 1068 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().map.getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().("y").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 2); |
| 1069 | }); |
| 1070 | } |
| 1071 | |
| 1072 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1073 | fn test_dataclass_missing_fieldrust-analyzer cargo pythonize 0.28.0 de/test/test_dataclass_missing_field().() { |
| 1074 | let code = c"\ |
| 1075 | from dataclasses import dataclass |
| 1076 | |
| 1077 | @dataclass |
| 1078 | class Point: |
| 1079 | x: int |
| 1080 | y: int |
| 1081 | |
| 1082 | point = Point(1, 2)"; |
| 1083 | |
| 1084 | #[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:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 1085 | struct Pointrust-analyzer cargo pythonize 0.28.0 de/test/Point# { |
| 1086 | xrust-analyzer cargo pythonize 0.28.0 de/test/Point#x.: i32, |
| 1087 | yrust-analyzer cargo pythonize 0.28.0 de/test/Point#y.: i32, |
| 1088 | zrust-analyzer cargo pythonize 0.28.0 de/test/Point#z.: i32, |
| 1089 | } |
| 1090 | |
| 1091 | Pythonrust-analyzer cargo pyo3 0.28.1 marker/Python#::attachrust-analyzer cargo pyo3 0.28.1 marker/impl#[`Python<'_>`]attach().(|py| { |
| 1092 | let locals = PyDictrust-analyzer cargo pyo3 0.28.1 types/dict/PyDict#::newrust-analyzer cargo pyo3 0.28.1 types/dict/impl#[PyDict]new().(py); |
| 1093 | py.runrust-analyzer cargo pyo3 0.28.1 marker/impl#[`Python<'py>`]run().(code, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&locals)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 1094 | let obj = locals.get_itemrust-analyzer cargo pyo3 0.28.1 types/dict/impl#[`Bound<'py, PyDict>`][`PyDictMethods<'py>`]get_item().("point").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 1095 | let err = depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().::<Pointrust-analyzer cargo pythonize 0.28.0 de/test/Point#>(&obj).unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().(); |
| 1096 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!( |
| 1097 | *rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T, A>`][Deref]deref().err.innerrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#inner., |
| 1098 | ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::Messagerust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#Message#(msg) if msg == "missing field `z`" |
| 1099 | )); |
| 1100 | }); |
| 1101 | } |
| 1102 | |
| 1103 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1104 | fn test_dataclass_extra_fieldrust-analyzer cargo pythonize 0.28.0 de/test/test_dataclass_extra_field().() { |
| 1105 | let code = c"\ |
| 1106 | from dataclasses import dataclass |
| 1107 | |
| 1108 | @dataclass |
| 1109 | class Point: |
| 1110 | x: int |
| 1111 | y: int |
| 1112 | z: int |
| 1113 | |
| 1114 | point = Point(1, 2, 3)"; |
| 1115 | |
| 1116 | #[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:, Deserializerust-analyzer cargo serde_derive 1.0.228 Deserialize:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 1117 | #[serde(deny_unknown_fields)] |
| 1118 | struct Pointrust-analyzer cargo pythonize 0.28.0 de/test/Point# { |
| 1119 | xrust-analyzer cargo pythonize 0.28.0 de/test/Point#x.: i32, |
| 1120 | yrust-analyzer cargo pythonize 0.28.0 de/test/Point#y.: i32, |
| 1121 | } |
| 1122 | |
| 1123 | Pythonrust-analyzer cargo pyo3 0.28.1 marker/Python#::attachrust-analyzer cargo pyo3 0.28.1 marker/impl#[`Python<'_>`]attach().(|py| { |
| 1124 | let locals = PyDictrust-analyzer cargo pyo3 0.28.1 types/dict/PyDict#::newrust-analyzer cargo pyo3 0.28.1 types/dict/impl#[PyDict]new().(py); |
| 1125 | py.runrust-analyzer cargo pyo3 0.28.1 marker/impl#[`Python<'py>`]run().(code, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&locals)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 1126 | let obj = locals.get_itemrust-analyzer cargo pyo3 0.28.1 types/dict/impl#[`Bound<'py, PyDict>`][`PyDictMethods<'py>`]get_item().("point").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 1127 | let err = depythonizerust-analyzer cargo pythonize 0.28.0 de/depythonize().::<Pointrust-analyzer cargo pythonize 0.28.0 de/test/Point#>(&obj).unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().(); |
| 1128 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!( |
| 1129 | *rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T, A>`][Deref]deref().err.innerrust-analyzer cargo pythonize 0.28.0 error/PythonizeError#inner., |
| 1130 | ErrorImplrust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#::Messagerust-analyzer cargo pythonize 0.28.0 error/ErrorImpl#Message#(msg) if msg == "unknown field `z`, expected `x` or `y`" |
| 1131 | )); |
| 1132 | }); |
| 1133 | } |
| 1134 | } |