Skip to content

Commit 442dcef

Browse files
committed
use pyo3 0.2 for example
1 parent 67932dc commit 442dcef

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

example/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.1.0"
44
authors = ["Nikolay Kim <[email protected]>"]
55

66
[dependencies.pyo3]
7-
version = "0.1.0"
7+
version = "0.2.0"
88
default-features = false
99

1010
[lib]

example/src/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
extern crate pyo3;
44

5-
use pyo3::*;
5+
use pyo3::prelude::*;
66

77
/// Module documentation string
88
#[py::modinit(_helloworld)]
99
fn init(py: Python, m: &PyModule) -> PyResult<()> {
1010

1111
#[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)
1414
}
1515

1616
#[pyfn(m, "val")]
@@ -21,14 +21,14 @@ fn init(py: Python, m: &PyModule) -> PyResult<()> {
2121
Ok(())
2222
}
2323

24-
fn run(py: Python, args: &PyTuple, kwargs: Option<&PyDict>) -> PyResult<()> {
24+
fn run(args: &PyTuple, kwargs: Option<&PyDict>) -> PyResult<()> {
2525
println!("Rust says: Hello Python!");
2626
for arg in args.iter() {
27-
println!("Rust got {}", arg.as_ref(py));
27+
println!("Rust got {}", arg);
2828
}
2929
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);
3232
}
3333
}
3434
Ok(())

0 commit comments

Comments
 (0)