@@ -84,7 +84,7 @@ struct StylesheetCache {
84
84
impl StylesheetCache {
85
85
#[ new]
86
86
#[ pyo3( text_signature = "(size=8)" ) ]
87
- fn new ( size : Option < & PyAny > ) -> PyResult < Self > {
87
+ fn new ( size : Option < & Bound < ' _ , PyAny > > ) -> PyResult < Self > {
88
88
let size = if let Some ( size) = size {
89
89
const ERROR_MESSAGE : & str = "Cache size must be an integer greater than zero" ;
90
90
let size = size
@@ -173,7 +173,7 @@ impl CSSInliner {
173
173
///
174
174
/// Inline CSS in multiple HTML documents
175
175
#[ pyo3( text_signature = "(htmls)" ) ]
176
- fn inline_many ( & self , htmls : & PyList ) -> PyResult < Vec < String > > {
176
+ fn inline_many ( & self , htmls : & Bound < ' _ , PyList > ) -> PyResult < Vec < String > > {
177
177
inline_many_impl ( & self . inner , htmls)
178
178
}
179
179
}
@@ -219,7 +219,7 @@ fn inline(
219
219
) ]
220
220
#[ allow( clippy:: too_many_arguments) ]
221
221
fn inline_many (
222
- htmls : & PyList ,
222
+ htmls : & Bound < ' _ , PyList > ,
223
223
inline_style_tags : Option < bool > ,
224
224
keep_style_tags : Option < bool > ,
225
225
keep_link_tags : Option < bool > ,
@@ -244,10 +244,10 @@ fn inline_many(
244
244
245
245
fn inline_many_impl (
246
246
inliner : & rust_inline:: CSSInliner < ' _ > ,
247
- htmls : & PyList ,
247
+ htmls : & Bound < ' _ , PyList > ,
248
248
) -> PyResult < Vec < String > > {
249
249
// Extract strings from the list. It will fail if there is any non-string value
250
- let extracted: Result < Vec < _ > , _ > = htmls. iter ( ) . map ( pyo3 :: PyAny :: extract :: < & str > ) . collect ( ) ;
250
+ let extracted: Result < Vec < _ > , _ > = htmls. iter ( ) . map ( |h| h . extract :: < String > ( ) ) . collect ( ) ;
251
251
let output: Result < Vec < _ > , _ > = extracted?
252
252
. par_iter ( )
253
253
. map ( |html| inliner. inline ( html) )
@@ -262,14 +262,15 @@ mod build {
262
262
263
263
/// Fast CSS inlining written in Rust
264
264
#[ pymodule]
265
- fn css_inline ( py : Python < ' _ > , module : & PyModule ) -> PyResult < ( ) > {
265
+ fn css_inline ( py : Python < ' _ > , module : & Bound < ' _ , PyModule > ) -> PyResult < ( ) > {
266
266
module. add_class :: < CSSInliner > ( ) ?;
267
267
module. add_class :: < StylesheetCache > ( ) ?;
268
268
module. add_wrapped ( wrap_pyfunction ! ( inline) ) ?;
269
269
module. add_wrapped ( wrap_pyfunction ! ( inline_many) ) ?;
270
- let inline_error = py. get_type :: < InlineError > ( ) ;
270
+ let inline_error = py. get_type_bound :: < InlineError > ( ) ;
271
271
inline_error. setattr ( "__doc__" , INLINE_ERROR_DOCSTRING ) ?;
272
272
module. add ( "InlineError" , inline_error) ?;
273
+ #[ allow( deprecated) ]
273
274
module. add ( "__build__" , pyo3_built:: pyo3_built!( py, build) ) ?;
274
275
Ok ( ( ) )
275
276
}
0 commit comments