Create a crate-private function init_submodule
to set up this submodule and call the same
function on child modules (which should also use this macro).
Implement AsMut<T>
for a Python wrapper around T
.
Implement Python comparison for a given type. That type must implement
PartialOrd
.
Implement ToPython<Self>
for a given type.
Implement
FromStr
for wrapper types whose inner type implements
FromStr
.
Implement
__hash__
for types that implement
Hash
.
Implement a method
parse
for wrapper types that implement
FromStr
.
Implement
__repr__
for wrapper types whose inner type implements
Debug
.
Implement
__str__
for wrapper types whose inner type implements
Display
.
Generate PyTryFrom
implementations for PyAny
that require the PyAny
to contain a specific Python type.
Implement
PyTryFrom<PyAny>
for a given Rust type by delegating to its implementation
for the given Python type.
Implement
ToPython
once for the given Rust type. Will implement for a reference to the type
if a lifetime is provided.
Implement
ToPython<Py<PyAny>>
for a type using its implementation for
ToPython<P>
where
P: ToPyObject
.
Implement
ToPython
on the given Rust type and a reference to it.
(Internal) Helper macro to implement chained conversion through intermediate types,
where the type system cannot determine a path from the first to last item.
(Internal) Helper macro to implement chained conversion through intermediate types,
where the type system cannot determine a path from the last to first item.
Provides a body for py_try_from
, delegating to the implementation for the given Python type.
(Internal) Helper macro to get the final type in a chain of conversions.
Convert a rust future into a Python awaitable using
pyo3_asyncio::tokio::future_into_py
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.
Spawn and block on a future using the pyo3 tokio runtime.
Useful for returning a synchronous PyResult
.
Wraps a data struct and makes (some of) its fields available to Python.
Creates a new exception type and implements converting from the given Rust error to the new
exception.
Wrap an enum containing only unit variants.
Create a newtype wrapper for a Rust struct.
Create a Python wrapper around a Rust type.
Create a newtype wrapper for a Rust enum with unique 1-tuple variants.
Wraps an external error type in a newtype
struct
so it can be used with
py_wrap_error
.