File tree Expand file tree Collapse file tree 3 files changed +42
-0
lines changed
Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ [package ]
2+ name = " iotext"
3+ version = " 0.1.0"
4+ rust-version = " 1.57.0"
5+
6+ [lib ]
7+ name = " _iotext"
8+ crate-type = [" cdylib" ]
9+
10+ [dependencies ]
11+ pyo3 = { version = " 0.19.0" , features = [" auto-initialize" , " extension-module" ] }
12+
13+ # dependencies
14+ fancy-regex = " 0.11.0"
15+ regex = " 1.8.3"
16+ rustc-hash = " 1.1.0"
17+ bstr = " 1.5.0"
18+
19+ [profile .release ]
20+ incremental = true
Original file line number Diff line number Diff line change 11mypy
22black == 22.3.0
33parameterized == 0.9.0
4+
5+ # required for RUST development
6+ maturin == 1.2.1
Original file line number Diff line number Diff line change 1+ // This check is new and seems buggy (possibly with PyO3 interaction)
2+ #![ allow( clippy:: borrow_deref_ref) ]
3+
4+ use pyo3:: prelude:: * ;
5+
6+ /// Formats the sum of two numbers as string.
7+ #[ pyfunction]
8+ fn sum_as_string ( a : usize , b : usize ) -> PyResult < String > {
9+ Ok ( ( a + b) . to_string ( ) )
10+ }
11+
12+ /// A Python module implemented in Rust. The name of this function must match
13+ /// the `lib.name` setting in the `Cargo.toml`, else Python will not be able to
14+ /// import the module.
15+ #[ pymodule]
16+ fn string_sum ( _py : Python < ' _ > , m : & PyModule ) -> PyResult < ( ) > {
17+ m. add_function ( wrap_pyfunction ! ( sum_as_string, m) ?) ?;
18+ Ok ( ( ) )
19+ }
You can’t perform that action at this time.
0 commit comments