Expand description
Re-exports§
pub use num_complex;pub use paste;pub use pyo3;
Modules§
Macros§
- create_
init_ submodule - Create a crate-private function
init_submoduleto set up this submodule and call the same function on child modules (which should also use this macro). - impl_
as_ mut_ for_ wrapper - Implement
AsMut<T>for a Python wrapper aroundT. - impl_
compare - Implement Python comparison for a given type. That type must implement
PartialOrd. - impl_
for_ self - Implement
ToPython<Self>for a given type. - impl_
from_ str - Implement
FromStrfor wrapper types whose inner type implementsFromStr. - impl_
hash - Implement
__hash__for types that implementHash. - impl_
parse - Implement a method
parsefor wrapper types that implementFromStr. - impl_
repr - Implement
__repr__for wrapper types whose inner type implementsDebug. - impl_
str - Implement
__str__for wrapper types whose inner type implementsDisplay. - private_
impl_ py_ try_ from - Implement
PyTryFromfor a given Rust type. - private_
impl_ py_ try_ from_ pyany - Generate
PyTryFromimplementations forPyAnythat require thePyAnyto contain a specific Python type. - private_
impl_ py_ try_ from_ with_ pyany - Implement
PyTryFrom<PyAny>for a given Rust type by delegating to its implementation for the given Python type. - private_
impl_ to_ python_ for - Implement
ToPythononce for the given Rust type. Will implement for a reference to the type if a lifetime is provided. - private_
impl_ to_ python_ pyany - Implement
ToPython<Py<PyAny>>for a type using its implementation forToPython<P>whereP: ToPyObject. - private_
impl_ to_ python_ with_ reference - Implement
ToPythonon the given Rust type and a reference to it. - private_
intermediate_ to_ python - (Internal) Helper macro to implement chained conversion through intermediate types, where the type system cannot determine a path from the first to last item.
- private_
intermediate_ try_ from_ python - (Internal) Helper macro to implement chained conversion through intermediate types, where the type system cannot determine a path from the last to first item.
- private_
py_ try_ from_ py_ pyany_ inner - Provides a body for
py_try_from, delegating to the implementation for the given Python type. - private_
ultimate_ type - (Internal) Helper macro to get the final type in a chain of conversions.
- py_
async - Convert a rust future into a Python awaitable using
pyo3_asyncio::tokio::future_into_py - py_
function_ sync_ async - Given a single implementation of an async function, create that function as private and two pyfunctions named after it that can be used to invoke either blocking or async variants of the same function.
- py_sync
- Spawn and block on a future using the pyo3 tokio runtime.
Useful for returning a synchronous
PyResult. - py_
wrap_ data_ struct - Wraps a data struct and makes (some of) its fields available to Python.
- py_
wrap_ error - Creates a new exception type and implements converting from the given Rust error to the new exception.
- py_
wrap_ simple_ enum - Wrap an enum containing only unit variants.
- py_
wrap_ struct - Create a newtype wrapper for a Rust struct.
- py_
wrap_ type - Create a Python wrapper around a Rust type.
- py_
wrap_ union_ enum - Create a newtype wrapper for a Rust enum with unique 1-tuple variants.
- wrap_
error - Wraps an external error type in a newtype
structso it can be used withpy_wrap_error.
Traits§
- PyTry
From - Convert from a Python type to a Rust type.
- PyWrapper
- Implemented by wrapper types generated with
py_wrap_*macros: - PyWrapper
Mut - Implemented by wrapper types containing the source type, generated with
py_wrap_*macros: - ToPython
- Convert from a Rust type into a Python type.
- ToPython
Error - Implemented by error types generated with
py_wrap_error.