pyo3::conversion

Trait IntoPy

Source
pub trait IntoPy<T>: Sized {
    // Required method
    fn into_py(self, py: Python<'_>) -> T;
}
๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Expand description

Defines a conversion from a Rust type to a Python object.

It functions similarly to stdโ€™s Into trait, but requires a GIL token as an argument. Many functions and traits internal to PyO3 require this trait as a bound, so a lack of this trait can manifest itself in different error messages.

ยงExamples

ยงWith #[pyclass]

The easiest way to implement IntoPy is by exposing a struct as a native Python object by annotating it with #[pyclass].

use pyo3::prelude::*;

#[pyclass]
struct Number {
    #[pyo3(get, set)]
    value: i32,
}

Python code will see this as an instance of the Number class with a value attribute.

ยงConversion to a Python object

However, it may not be desirable to expose the existence of Number to Python code. IntoPy allows us to define a conversion to an appropriate Python object.

#![allow(deprecated)]
use pyo3::prelude::*;

struct Number {
    value: i32,
}

impl IntoPy<PyObject> for Number {
    fn into_py(self, py: Python<'_>) -> PyObject {
        // delegates to i32's IntoPy implementation.
        self.value.into_py(py)
    }
}

Python code will see this as an int object.

ยงDynamic conversion into Python objects.

It is also possible to return a different Python object depending on some condition. This is useful for types like enums that can carry different types.

#![allow(deprecated)]
use pyo3::prelude::*;

enum Value {
    Integer(i32),
    String(String),
    None,
}

impl IntoPy<PyObject> for Value {
    fn into_py(self, py: Python<'_>) -> PyObject {
        match self {
            Self::Integer(val) => val.into_py(py),
            Self::String(val) => val.into_py(py),
            Self::None => py.None(),
        }
    }
}

Python code will see this as any of the int, string or None objects.

Required Methodsยง

Source

fn into_py(self, py: Python<'_>) -> T

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.

Performs the conversion.

Dyn Compatibilityยง

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Typesยง

Sourceยง

impl IntoPy<Py<PyAny>> for &str

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for &String

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for &OsStr

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for &OsString

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for &Path

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for &PathBuf

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for &[u8]

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for Cow<'_, str>

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for Cow<'_, OsStr>

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for Cow<'_, Path>

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for Cow<'_, [u8]>

Sourceยง

fn into_py(self, py: Python<'_>) -> Py<PyAny>

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for IpAddr

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for bool

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for char

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for f32

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for f64

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for i8

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for i16

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for i32

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for i64

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for i128

Available on non-Py_LIMITED_API and non-GraalPy only.
Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for isize

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for u8

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for u16

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for u32

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for u64

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for u128

Available on non-Py_LIMITED_API and non-GraalPy only.
Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for ()

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for usize

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for String

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for Duration

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for OsString

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for PathBuf

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for SystemTime

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for NaiveDate

Available on crate feature chrono only.
Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for NaiveDateTime

Available on crate feature chrono only.
Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for NaiveTime

Available on crate feature chrono only.
Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for FixedOffset

Available on crate feature chrono only.
Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for Utc

Available on crate feature chrono only.
Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for BigInt

Available on crate feature num-bigint only.
Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for BigUint

Available on crate feature num-bigint only.
Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for Complex<f32>

Available on crate feature num-complex only.
Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for Complex<f64>

Available on crate feature num-complex only.
Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for Ratio<i8>

Available on crate feature num-rational only.
Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for Ratio<i16>

Available on crate feature num-rational only.
Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for Ratio<i32>

Available on crate feature num-rational only.
Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for Ratio<i64>

Available on crate feature num-rational only.
Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for Ratio<isize>

Available on crate feature num-rational only.
Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for Ratio<BigInt>

Available on crate feature num-rational only.
Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for NonZeroI8

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for NonZeroI16

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for NonZeroI32

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for NonZeroI64

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for NonZeroI128

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for NonZeroIsize

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for NonZeroU8

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for NonZeroU16

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for NonZeroU32

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for NonZeroU64

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for NonZeroU128

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for NonZeroUsize

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for Duration

Available on crate feature chrono only.
Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyAny>> for Decimal

Available on crate feature rust_decimal only.
Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyString>> for &str

Sourceยง

fn into_py(self, py: Python<'_>) -> Py<PyString>

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl IntoPy<Py<PyTuple>> for ()

Converts () to an empty Python tuple.

Sourceยง

fn into_py(self, py: Python<'_>) -> Py<PyTuple>

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<A> IntoPy<Py<PyAny>> for SmallVec<A>
where A: Array, A::Item: IntoPy<PyObject>,

Available on crate feature smallvec only.
Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<K> IntoPy<Py<PyAny>> for BTreeSet<K>
where K: IntoPy<PyObject> + Ord,

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<K, S> IntoPy<Py<PyAny>> for HashSet<K, S>
where K: IntoPy<PyObject> + Eq + Hash, S: BuildHasher + Default,

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<K, S> IntoPy<Py<PyAny>> for HashSet<K, S>
where K: IntoPy<PyObject> + Eq + Hash, S: BuildHasher + Default,

Available on crate feature hashbrown only.
Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<K, V> IntoPy<Py<PyAny>> for BTreeMap<K, V>
where K: Eq + IntoPy<PyObject>, V: IntoPy<PyObject>,

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<K, V, H> IntoPy<Py<PyAny>> for HashMap<K, V, H>
where K: Hash + Eq + IntoPy<PyObject>, V: IntoPy<PyObject>, H: BuildHasher,

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<K, V, H> IntoPy<Py<PyAny>> for HashMap<K, V, H>
where K: Hash + Eq + IntoPy<PyObject>, V: IntoPy<PyObject>, H: BuildHasher,

Available on crate feature hashbrown only.
Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<K, V, H> IntoPy<Py<PyAny>> for IndexMap<K, V, H>
where K: Hash + Eq + IntoPy<PyObject>, V: IntoPy<PyObject>, H: BuildHasher,

Available on crate feature indexmap only.
Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<L, R> IntoPy<Py<PyAny>> for Either<L, R>
where L: IntoPy<PyObject>, R: IntoPy<PyObject>,

Available on crate feature either only.
Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T0: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (T0,)

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T0: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (T0,)

Sourceยง

fn into_py(self, py: Python<'_>) -> Py<PyTuple>

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (T0, T1)

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (T0, T1)

Sourceยง

fn into_py(self, py: Python<'_>) -> Py<PyTuple>

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (T0, T1, T2)

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (T0, T1, T2)

Sourceยง

fn into_py(self, py: Python<'_>) -> Py<PyTuple>

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (T0, T1, T2, T3)

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (T0, T1, T2, T3)

Sourceยง

fn into_py(self, py: Python<'_>) -> Py<PyTuple>

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (T0, T1, T2, T3, T4)

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (T0, T1, T2, T3, T4)

Sourceยง

fn into_py(self, py: Python<'_>) -> Py<PyTuple>

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (T0, T1, T2, T3, T4, T5)

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (T0, T1, T2, T3, T4, T5)

Sourceยง

fn into_py(self, py: Python<'_>) -> Py<PyTuple>

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>, T6: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (T0, T1, T2, T3, T4, T5, T6)

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>, T6: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (T0, T1, T2, T3, T4, T5, T6)

Sourceยง

fn into_py(self, py: Python<'_>) -> Py<PyTuple>

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>, T6: IntoPy<PyObject>, T7: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (T0, T1, T2, T3, T4, T5, T6, T7)

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>, T6: IntoPy<PyObject>, T7: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (T0, T1, T2, T3, T4, T5, T6, T7)

Sourceยง

fn into_py(self, py: Python<'_>) -> Py<PyTuple>

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>, T6: IntoPy<PyObject>, T7: IntoPy<PyObject>, T8: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (T0, T1, T2, T3, T4, T5, T6, T7, T8)

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>, T6: IntoPy<PyObject>, T7: IntoPy<PyObject>, T8: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (T0, T1, T2, T3, T4, T5, T6, T7, T8)

Sourceยง

fn into_py(self, py: Python<'_>) -> Py<PyTuple>

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>, T6: IntoPy<PyObject>, T7: IntoPy<PyObject>, T8: IntoPy<PyObject>, T9: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>, T6: IntoPy<PyObject>, T7: IntoPy<PyObject>, T8: IntoPy<PyObject>, T9: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)

Sourceยง

fn into_py(self, py: Python<'_>) -> Py<PyTuple>

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>, T6: IntoPy<PyObject>, T7: IntoPy<PyObject>, T8: IntoPy<PyObject>, T9: IntoPy<PyObject>, T10: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>, T6: IntoPy<PyObject>, T7: IntoPy<PyObject>, T8: IntoPy<PyObject>, T9: IntoPy<PyObject>, T10: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

Sourceยง

fn into_py(self, py: Python<'_>) -> Py<PyTuple>

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>, T6: IntoPy<PyObject>, T7: IntoPy<PyObject>, T8: IntoPy<PyObject>, T9: IntoPy<PyObject>, T10: IntoPy<PyObject>, T11: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>, T6: IntoPy<PyObject>, T7: IntoPy<PyObject>, T8: IntoPy<PyObject>, T9: IntoPy<PyObject>, T10: IntoPy<PyObject>, T11: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)

Sourceยง

fn into_py(self, py: Python<'_>) -> Py<PyTuple>

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T> IntoPy<Py<PyAny>> for Option<T>
where T: IntoPy<PyObject>,

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T> IntoPy<Py<PyAny>> for Vec<T>
where T: IntoPy<PyObject>,

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T, const N: usize> IntoPy<Py<PyAny>> for [T; N]
where T: IntoPy<PyObject>,

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<T: Copy + IntoPy<PyObject>> IntoPy<Py<PyAny>> for Cell<T>

Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Sourceยง

impl<Tz: TimeZone> IntoPy<Py<PyAny>> for DateTime<Tz>

Available on crate feature chrono only.
Sourceยง

fn into_py(self, py: Python<'_>) -> PyObject

๐Ÿ‘ŽDeprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.

Implementorsยง

Sourceยง

impl IntoPy<Py<PyAny>> for &PyErr

Sourceยง

impl IntoPy<Py<PyAny>> for Coroutine

Available on crate feature experimental-async only.
Sourceยง

impl IntoPy<Py<PyAny>> for PyErr

Sourceยง

impl IntoPy<Py<PyAny>> for PyBackedBytes

Sourceยง

impl IntoPy<Py<PyAny>> for PyBackedStr

Sourceยง

impl IntoPy<Py<PyString>> for &Bound<'_, PyString>

Sourceยง

impl IntoPy<Py<PyString>> for &Py<PyString>

Sourceยง

impl IntoPy<Py<PyString>> for Bound<'_, PyString>

Sourceยง

impl IntoPy<Py<PyTuple>> for &Bound<'_, PyTuple>

Sourceยง

impl IntoPy<Py<PyTuple>> for Bound<'_, PyTuple>

Sourceยง

impl<T> IntoPy<Py<PyAny>> for &Bound<'_, T>

Sourceยง

impl<T> IntoPy<Py<PyAny>> for &Py<T>

Sourceยง

impl<T> IntoPy<Py<PyAny>> for Borrowed<'_, '_, T>

Sourceยง

impl<T> IntoPy<Py<PyAny>> for Bound<'_, T>

Sourceยง

impl<T> IntoPy<Py<PyAny>> for Py<T>

Sourceยง

impl<T: PyClass> IntoPy<Py<PyAny>> for &PyRef<'_, T>

Sourceยง

impl<T: PyClass> IntoPy<Py<PyAny>> for PyRef<'_, T>

Sourceยง

impl<T: PyClass<Frozen = False>> IntoPy<Py<PyAny>> for &PyRefMut<'_, T>

Sourceยง

impl<T: PyClass<Frozen = False>> IntoPy<Py<PyAny>> for PyRefMut<'_, T>

โš ๏ธ Internal Docs โš ๏ธ Not Public API ๐Ÿ‘‰ Official Docs Here