|
1 | 1 | use pyo3::{types::*, Bound}; |
2 | | -use serde::de::{self, DeserializeOwned, IntoDeserializer}; |
| 2 | +use serde::de::{self, IntoDeserializer}; |
3 | 3 | use serde::Deserialize; |
4 | 4 |
|
5 | 5 | use crate::error::{ErrorImpl, PythonizeError, Result}; |
|
12 | 12 | T::deserialize(&mut Depythonizer::from_object(obj)) |
13 | 13 | } |
14 | 14 |
|
15 | | -/// Attempt to convert a Python object to an instance of `T` |
16 | | -#[deprecated(since = "0.22.0", note = "use `depythonize` instead")] |
17 | | -pub fn depythonize_bound<T>(obj: Bound<PyAny>) -> Result<T> |
18 | | -where |
19 | | - T: DeserializeOwned, |
20 | | -{ |
21 | | - T::deserialize(&mut Depythonizer::from_object(&obj)) |
22 | | -} |
23 | | - |
24 | 15 | /// A structure that deserializes Python objects into Rust values |
25 | 16 | pub struct Depythonizer<'a, 'py> { |
26 | 17 | input: &'a Bound<'py, PyAny>, |
@@ -541,12 +532,9 @@ mod test { |
541 | 532 | let obj = py.eval(code, None, None).unwrap(); |
542 | 533 | let actual: T = depythonize(&obj).unwrap(); |
543 | 534 | assert_eq!(&actual, expected); |
| 535 | + |
544 | 536 | let actual_json: JsonValue = depythonize(&obj).unwrap(); |
545 | 537 | assert_eq!(&actual_json, expected_json); |
546 | | - |
547 | | - #[allow(deprecated)] |
548 | | - let actual: T = depythonize_bound(obj.clone()).unwrap(); |
549 | | - assert_eq!(&actual, expected); |
550 | 538 | }); |
551 | 539 | } |
552 | 540 |
|
|
0 commit comments