Expand description
PyO3 bindings and the Python wrapper package for a bridge crate.
Like the JS side, the binding layer follows port.rs: strings, ints, floats, bools and
lists or options of those cross natively; anything structured crosses as JSON text, which
the wrapper package (python/<lib>/__init__.py) encodes and decodes with Python markers.
Constants§
- PYCONV_
RS src/pyconv.rs: Python objects toserde_json::Valueand back, in Rust, without JSON text. Values the JSON model lacks use the same markers as recorded cases:$tuple,$set,$bytes,$int(beyond i64),$dict(non-string keys),$num(NaN, infinities, -0).- PYNUM_
RS src/pynum.rs: Python’s int-or-float, for ports of code that takes either.
Functions§
- has_
literal_ default - Whether a parameter keeps Python’s literal default (and is a plain, non-
Optiontype). - lib_rs
- package_
init - The wrapper package: imports
_native, converting structured values. - rust_
literal - A Python literal default as a Rust expression, for
#[pyo3(signature = ...)]: strings, numbers and booleans.Noneand other expressions returnNone(the parameter is anOption, andNonestands for the default).