2
2
3
3
extern crate pyo3;
4
4
5
- use pyo3:: * ;
5
+ use pyo3:: prelude :: * ;
6
6
7
7
/// Module documentation string
8
8
#[ py:: modinit( _helloworld) ]
9
9
fn init ( py : Python , m : & PyModule ) -> PyResult < ( ) > {
10
10
11
11
#[ pyfn( m, "run" , args="*" , kwargs="**" ) ]
12
- fn run_fn ( py : Python , args : & PyTuple , kwargs : Option < & PyDict > ) -> PyResult < ( ) > {
13
- run ( py , args, kwargs)
12
+ fn run_fn ( _py : Python , args : & PyTuple , kwargs : Option < & PyDict > ) -> PyResult < ( ) > {
13
+ run ( args, kwargs)
14
14
}
15
15
16
16
#[ pyfn( m, "val" ) ]
@@ -21,14 +21,14 @@ fn init(py: Python, m: &PyModule) -> PyResult<()> {
21
21
Ok ( ( ) )
22
22
}
23
23
24
- fn run ( py : Python , args : & PyTuple , kwargs : Option < & PyDict > ) -> PyResult < ( ) > {
24
+ fn run ( args : & PyTuple , kwargs : Option < & PyDict > ) -> PyResult < ( ) > {
25
25
println ! ( "Rust says: Hello Python!" ) ;
26
26
for arg in args. iter ( ) {
27
- println ! ( "Rust got {}" , arg. as_ref ( py ) ) ;
27
+ println ! ( "Rust got {}" , arg) ;
28
28
}
29
29
if let Some ( kwargs) = kwargs {
30
- for ( key, val) in kwargs. items_vec ( ) {
31
- println ! ( "{} = {}" , key. as_ref ( py ) , val. as_ref ( py ) ) ;
30
+ for ( key, val) in kwargs. iter ( ) {
31
+ println ! ( "{} = {}" , key, val) ;
32
32
}
33
33
}
34
34
Ok ( ( ) )
0 commit comments