Trait pyo3::conversion::IntoPy

source ·
pub trait IntoPy<T>: Sized {
    // Required method
    fn into_py(self, py: Python<'_>) -> T;

    // Provided method
    fn type_output() -> TypeInfo { ... }
}
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.

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.

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

Performs the conversion.

Provided Methods§

source

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.

Extracts the type hint information for this type when it appears as a return value.

For example, Vec<u32> would return List[int]. The default implementation returns Any, which is correct for any type.

For most types, the return value for this method will be identical to that of FromPyObject::type_input. It may be different for some types, such as Dict, to allow duck-typing: functions return Dict but take Mapping as argument.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl IntoPy<Py<PyAny>> for &OsStr

source§

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

source§

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

source§

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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
source§

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

source§

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

source§

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

source§

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

source§

impl IntoPy<Py<PyAny>> for IpAddr

source§

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

source§

impl IntoPy<Py<PyAny>> for Tz

Available on Py_3_9 and crate feature chrono-tz only.
source§

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

source§

impl IntoPy<Py<PyAny>> for bool

source§

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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
source§

impl IntoPy<Py<PyAny>> for char

source§

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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
source§

impl IntoPy<Py<PyAny>> for f32

source§

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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
source§

impl IntoPy<Py<PyAny>> for f64

source§

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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
source§

impl IntoPy<Py<PyAny>> for i8

source§

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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
source§

impl IntoPy<Py<PyAny>> for i16

source§

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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
source§

impl IntoPy<Py<PyAny>> for i32

source§

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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
source§

impl IntoPy<Py<PyAny>> for i64

source§

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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
source§

impl IntoPy<Py<PyAny>> for isize

source§

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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
source§

impl IntoPy<Py<PyAny>> for u8

source§

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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
source§

impl IntoPy<Py<PyAny>> for u16

source§

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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
source§

impl IntoPy<Py<PyAny>> for u32

source§

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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
source§

impl IntoPy<Py<PyAny>> for u64

source§

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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
source§

impl IntoPy<Py<PyAny>> for ()

source§

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

source§

impl IntoPy<Py<PyAny>> for usize

source§

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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
source§

impl IntoPy<Py<PyAny>> for String

source§

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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
source§

impl IntoPy<Py<PyAny>> for Duration

source§

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

source§

impl IntoPy<Py<PyAny>> for OsString

source§

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

source§

impl IntoPy<Py<PyAny>> for PathBuf

source§

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

source§

impl IntoPy<Py<PyAny>> for SystemTime

source§

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

source§

impl IntoPy<Py<PyAny>> for NaiveDate

Available on crate feature chrono only.
source§

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

source§

impl IntoPy<Py<PyAny>> for NaiveDateTime

Available on crate feature chrono only.
source§

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

source§

impl IntoPy<Py<PyAny>> for NaiveTime

Available on crate feature chrono only.
source§

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

source§

impl IntoPy<Py<PyAny>> for FixedOffset

Available on crate feature chrono only.
source§

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

source§

impl IntoPy<Py<PyAny>> for Utc

Available on crate feature chrono only.
source§

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

source§

impl IntoPy<Py<PyAny>> for BigInt

Available on crate feature num-bigint only.
source§

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

source§

impl IntoPy<Py<PyAny>> for BigUint

Available on crate feature num-bigint only.
source§

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

source§

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

Available on crate feature num-complex only.
source§

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

source§

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

Available on crate feature num-complex only.
source§

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

source§

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

Available on crate feature num-rational only.
source§

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

source§

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

Available on crate feature num-rational only.
source§

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

source§

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

Available on crate feature num-rational only.
source§

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

source§

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

Available on crate feature num-rational only.
source§

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

source§

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

Available on crate feature num-rational only.
source§

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

source§

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

Available on crate feature num-rational only.
source§

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

source§

impl IntoPy<Py<PyAny>> for Decimal

Available on crate feature rust_decimal only.
source§

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

source§

impl IntoPy<Py<PyAny>> for NonZeroI8

source§

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

source§

impl IntoPy<Py<PyAny>> for NonZeroI16

source§

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

source§

impl IntoPy<Py<PyAny>> for NonZeroI32

source§

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

source§

impl IntoPy<Py<PyAny>> for NonZeroI64

source§

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

source§

impl IntoPy<Py<PyAny>> for NonZeroI128

source§

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

source§

impl IntoPy<Py<PyAny>> for NonZeroIsize

source§

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

source§

impl IntoPy<Py<PyAny>> for NonZeroU8

source§

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

source§

impl IntoPy<Py<PyAny>> for NonZeroU16

source§

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

source§

impl IntoPy<Py<PyAny>> for NonZeroU32

source§

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

source§

impl IntoPy<Py<PyAny>> for NonZeroU64

source§

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

source§

impl IntoPy<Py<PyAny>> for NonZeroU128

source§

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

source§

impl IntoPy<Py<PyAny>> for NonZeroUsize

source§

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

source§

impl IntoPy<Py<PyAny>> for Duration

Available on crate feature chrono only.
source§

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

source§

impl IntoPy<Py<PyTuple>> for ()

Converts () to an empty Python tuple.

source§

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

source§

impl<'a> IntoPy<Py<PyAny>> for &'a str

source§

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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
source§

impl<'a> IntoPy<Py<PyAny>> for &'a String

source§

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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
source§

impl<'a> IntoPy<Py<PyAny>> for &'a OsString

source§

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

source§

impl<'a> IntoPy<Py<PyAny>> for &'a Path

source§

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

source§

impl<'a> IntoPy<Py<PyAny>> for &'a PathBuf

source§

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

source§

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

source§

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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
source§

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

source§

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

source§

impl<'a> IntoPy<Py<PyString>> for &'a str

source§

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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
source§

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

source§

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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
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

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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
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

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

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

source§

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

source§

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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
source§

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

source§

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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
source§

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

source§

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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
source§

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

source§

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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
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>

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
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>

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
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>

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
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>

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
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>

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
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>

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
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>

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
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>

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
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>

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
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>

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
source§

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

source§

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

source§

impl<T> IntoPy<Py<PyAny>> for &T
where T: AsRef<PyAny>,

source§

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

source§

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

source§

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

source§

fn type_output() -> TypeInfo

Available on crate feature experimental-inspect only.
source§

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

source§

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

source§

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

source§

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

source§

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

Available on crate feature chrono only.
source§

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

Implementors§

source§

impl IntoPy<Py<CancelledError>> for &CancelledError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<IncompleteReadError>> for &IncompleteReadError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<InvalidStateError>> for &InvalidStateError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<LimitOverrunError>> for &LimitOverrunError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<QueueEmpty>> for &QueueEmpty

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<QueueFull>> for &QueueFull

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<TimeoutError>> for &TimeoutError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<gaierror>> for &gaierror

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<herror>> for &herror

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<timeout>> for &timeout

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyArithmeticError>> for &PyArithmeticError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyAssertionError>> for &PyAssertionError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyAttributeError>> for &PyAttributeError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyBaseException>> for &PyBaseException

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyBlockingIOError>> for &PyBlockingIOError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyBrokenPipeError>> for &PyBrokenPipeError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyBufferError>> for &PyBufferError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyBytesWarning>> for &PyBytesWarning

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyChildProcessError>> for &PyChildProcessError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyConnectionAbortedError>> for &PyConnectionAbortedError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyConnectionError>> for &PyConnectionError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyConnectionRefusedError>> for &PyConnectionRefusedError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyConnectionResetError>> for &PyConnectionResetError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyDeprecationWarning>> for &PyDeprecationWarning

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyEOFError>> for &PyEOFError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyEncodingWarning>> for &PyEncodingWarning

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyEnvironmentError>> for &PyEnvironmentError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyException>> for &PyException

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyFileExistsError>> for &PyFileExistsError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyFileNotFoundError>> for &PyFileNotFoundError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyFloatingPointError>> for &PyFloatingPointError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyFutureWarning>> for &PyFutureWarning

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyGeneratorExit>> for &PyGeneratorExit

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyIOError>> for &PyIOError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyImportError>> for &PyImportError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyImportWarning>> for &PyImportWarning

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyIndexError>> for &PyIndexError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyInterruptedError>> for &PyInterruptedError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyIsADirectoryError>> for &PyIsADirectoryError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyKeyError>> for &PyKeyError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyKeyboardInterrupt>> for &PyKeyboardInterrupt

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyLookupError>> for &PyLookupError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyMemoryError>> for &PyMemoryError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyModuleNotFoundError>> for &PyModuleNotFoundError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyNameError>> for &PyNameError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyNotADirectoryError>> for &PyNotADirectoryError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyNotImplementedError>> for &PyNotImplementedError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyOSError>> for &PyOSError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyOverflowError>> for &PyOverflowError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyPendingDeprecationWarning>> for &PyPendingDeprecationWarning

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyPermissionError>> for &PyPermissionError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyProcessLookupError>> for &PyProcessLookupError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyRecursionError>> for &PyRecursionError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyReferenceError>> for &PyReferenceError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyResourceWarning>> for &PyResourceWarning

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyRuntimeError>> for &PyRuntimeError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyRuntimeWarning>> for &PyRuntimeWarning

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyStopAsyncIteration>> for &PyStopAsyncIteration

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyStopIteration>> for &PyStopIteration

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PySyntaxError>> for &PySyntaxError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PySyntaxWarning>> for &PySyntaxWarning

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PySystemError>> for &PySystemError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PySystemExit>> for &PySystemExit

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyTimeoutError>> for &PyTimeoutError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyTypeError>> for &PyTypeError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyUnboundLocalError>> for &PyUnboundLocalError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyUnicodeDecodeError>> for &PyUnicodeDecodeError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyUnicodeEncodeError>> for &PyUnicodeEncodeError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyUnicodeError>> for &PyUnicodeError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyUnicodeTranslateError>> for &PyUnicodeTranslateError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyUnicodeWarning>> for &PyUnicodeWarning

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyUserWarning>> for &PyUserWarning

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyValueError>> for &PyValueError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyWarning>> for &PyWarning

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyZeroDivisionError>> for &PyZeroDivisionError

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PanicException>> for &PanicException

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyAny>> for &PyAny

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<PyBool>> for &PyBool

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyByteArray>> for &PyByteArray

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyBytes>> for &PyBytes

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyCFunction>> for &PyCFunction

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyCapsule>> for &PyCapsule

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyCode>> for &PyCode

Available on non-Py_LIMITED_API and non-PyPy and non-GraalPy and crate feature gil-refs only.
source§

impl IntoPy<Py<PyComplex>> for &PyComplex

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyDate>> for &PyDate

Available on non-Py_LIMITED_API and crate feature gil-refs only.
source§

impl IntoPy<Py<PyDateTime>> for &PyDateTime

Available on non-Py_LIMITED_API and crate feature gil-refs only.
source§

impl IntoPy<Py<PyDelta>> for &PyDelta

Available on non-Py_LIMITED_API and crate feature gil-refs only.
source§

impl IntoPy<Py<PyDict>> for &PyDict

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyDictItems>> for &PyDictItems

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyDictKeys>> for &PyDictKeys

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyDictValues>> for &PyDictValues

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyEllipsis>> for &PyEllipsis

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyFloat>> for &PyFloat

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyFrame>> for &PyFrame

Available on non-Py_LIMITED_API and non-PyPy and non-GraalPy and crate feature gil-refs only.
source§

impl IntoPy<Py<PyFrozenSet>> for &PyFrozenSet

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyFunction>> for &PyFunction

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyIterator>> for &PyIterator

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyList>> for &PyList

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyLong>> for &PyLong

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyMapping>> for &PyMapping

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyMemoryView>> for &PyMemoryView

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyModule>> for &PyModule

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyNone>> for &PyNone

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyNotImplemented>> for &PyNotImplemented

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PySequence>> for &PySequence

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PySet>> for &PySet

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PySlice>> for &PySlice

Available on crate feature gil-refs only.
source§

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

source§

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

source§

impl IntoPy<Py<PyString>> for &PyString

Available on crate feature gil-refs only.
source§

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

source§

impl IntoPy<Py<PySuper>> for &PySuper

Available on neither PyPy nor GraalPy and crate feature gil-refs only.
source§

impl IntoPy<Py<PyTime>> for &PyTime

Available on non-Py_LIMITED_API and crate feature gil-refs only.
source§

impl IntoPy<Py<PyTraceback>> for &PyTraceback

Available on crate feature gil-refs only.
source§

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

source§

impl IntoPy<Py<PyTuple>> for &PyTuple

Available on crate feature gil-refs only.
source§

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

source§

impl IntoPy<Py<PyType>> for &PyType

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyTzInfo>> for &PyTzInfo

Available on non-Py_LIMITED_API and crate feature gil-refs only.
source§

impl IntoPy<Py<PyWeakref>> for &PyWeakref

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyWeakrefProxy>> for &PyWeakrefProxy

Available on crate feature gil-refs only.
source§

impl IntoPy<Py<PyWeakrefReference>> for &PyWeakrefReference

Available on crate feature gil-refs only.
source§

impl<'a> IntoPy<Py<PyAny>> for &'a PyErr

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>