1- use pyo3:: { types:: * , Bound , PyNativeType } ;
1+ use pyo3:: { types:: * , Bound } ;
22use serde:: de:: { self , IntoDeserializer } ;
33use serde:: Deserialize ;
44
1414}
1515
1616/// Attempt to convert a Python object to an instance of `T`
17- #[ deprecated(
18- since = "0.21.1" ,
19- note = "will be replaced by `depythonize` in a future release"
20- ) ]
17+ #[ deprecated( since = "0.22.0" , note = "use `depythonize` instead" ) ]
2118pub fn depythonize_bound < ' py , T > ( obj : Bound < ' py , PyAny > ) -> Result < T >
2219where
2320 T : for < ' a > Deserialize < ' a > ,
@@ -26,30 +23,14 @@ where
2623 T :: deserialize ( & mut depythonizer)
2724}
2825
29- /// Attempt to convert a Python object to an instance of `T`
30- #[ deprecated(
31- since = "0.21.1" ,
32- note = "will be replaced by `depythonize` in a future release"
33- ) ]
34- pub fn depythonize_object < ' de , T > ( obj : & ' de PyAny ) -> Result < T >
35- where
36- T : Deserialize < ' de > ,
37- {
38- let obj = obj. as_borrowed ( ) . to_owned ( ) ;
39- let mut depythonizer = Depythonizer :: from_object ( & obj) ;
40- T :: deserialize ( & mut depythonizer)
41- }
42-
4326/// A structure that deserializes Python objects into Rust values
4427pub struct Depythonizer < ' py , ' bound > {
4528 input : & ' bound Bound < ' py , PyAny > ,
4629}
4730
4831impl < ' py , ' bound > Depythonizer < ' py , ' bound > {
4932 /// Create a deserializer from a Python object
50- pub fn from_object < ' input , ' gil > (
51- input : & ' input Bound < ' gil , PyAny > ,
52- ) -> Depythonizer < ' gil , ' input > {
33+ pub fn from_object < ' input > ( input : & ' input Bound < ' py , PyAny > ) -> Depythonizer < ' py , ' input > {
5334 Depythonizer { input }
5435 }
5536
0 commit comments