File tree Expand file tree Collapse file tree 5 files changed +25
-21
lines changed Expand file tree Collapse file tree 5 files changed +25
-21
lines changed Original file line number Diff line number Diff line change
1
+ #[ macro_use]
1
2
extern crate pyo3;
2
3
3
4
use pyo3:: prelude:: * ;
4
5
5
- /// Module documentation string
6
- #[ pymodinit]
7
- fn english ( _py : Python , m : & PyModule ) -> PyResult < ( ) > {
6
+ #[ pyfunction]
7
+ fn hello ( _py : Python ) -> PyResult < ( ) > {
8
+ println ! ( "Hello, world!" ) ;
9
+ Ok ( ( ) )
10
+ }
8
11
9
- #[ pyfn( m, "hello" ) ]
10
- fn hello ( _py : Python ) -> PyResult < ( ) > {
11
- println ! ( "Hello, world!" ) ;
12
- Ok ( ( ) )
13
- }
14
12
13
+ #[ pymodule]
14
+ /// Module documentation string
15
+ fn english ( _py : Python , m : & PyModule ) -> PyResult < ( ) > {
16
+ m. add_wrapped ( wrap_function ! ( hello) ) ?;
15
17
Ok ( ( ) )
16
18
}
Original file line number Diff line number Diff line change
1
+ #[ macro_use]
1
2
extern crate pyo3;
2
3
3
4
use pyo3:: prelude:: * ;
4
5
5
- /// Module documentation string
6
- #[ pymodinit]
7
- fn french ( _py : Python , m : & PyModule ) -> PyResult < ( ) > {
6
+ #[ pyfunction]
7
+ fn hello ( _py : Python ) -> PyResult < ( ) > {
8
+ println ! ( "Bonjour, monde!" ) ;
9
+ Ok ( ( ) )
10
+ }
8
11
9
- #[ pyfn( m, "hello" ) ]
10
- fn hello ( _py : Python ) -> PyResult < ( ) > {
11
- println ! ( "Bonjour, monde!" ) ;
12
- Ok ( ( ) )
13
- }
14
12
13
+ #[ pymodule]
14
+ /// Module documentation string
15
+ fn french ( _py : Python , m : & PyModule ) -> PyResult < ( ) > {
16
+ m. add_wrapped ( wrap_function ! ( hello) ) ?;
15
17
Ok ( ( ) )
16
18
}
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ zip_safe = false
10
10
create_workspace = true
11
11
12
12
[tomlgen_rust.dependencies]
13
- pyo3 = { version = " 0.5 .0-alpha.3 " , features = [" extension-module" ] }
13
+ pyo3 = { version = " 0.6 .0-alpha" , features = [" extension-module" ] }
14
14
15
15
[tomlgen_rust.dependencies.hello-english]
16
16
english-lint = " *"
Original file line number Diff line number Diff line change 5
5
6
6
[dependencies ]
7
7
kuchiki = " 0.7.2"
8
- pyo3 = {git = " https://github.com/PyO3/pyo3 " , features = [" extension-module" ]}
8
+ pyo3 = { version = " 0.6.0-alpha " , features = [" extension-module" ]}
9
9
tendril = " 0.4.0"
10
10
11
11
[lib ]
Original file line number Diff line number Diff line change @@ -55,10 +55,10 @@ fn parse_text(text: &str) -> PyResult<Document> {
55
55
Ok ( document)
56
56
}
57
57
58
- #[ pymodinit ]
58
+ #[ pymodule ]
59
59
fn html_py_ever ( _py : Python , m : & PyModule ) -> PyResult < ( ) > {
60
- m. add_function ( wrap_function ! ( parse_file) ) ?;
61
- m. add_function ( wrap_function ! ( parse_text) ) ?;
60
+ m. add_wrapped ( wrap_function ! ( parse_file) ) ?;
61
+ m. add_wrapped ( wrap_function ! ( parse_text) ) ?;
62
62
m. add_class :: < Document > ( ) ?;
63
63
64
64
Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments