pub trait ToPyObject {
// Required method
fn to_object(&self, py: Python<'_>) -> PyObject;
}
👎Deprecated since 0.23.0:
ToPyObject
is going to be replaced by IntoPyObject
. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.Expand description
Conversion trait that allows various objects to be converted into PyObject
.
Required Methods§
Implementations on Foreign Types§
Source§impl ToPyObject for Cow<'_, str>
impl ToPyObject for Cow<'_, str>
Converts a Rust Cow<'_, str>
to a Python object.
See PyString::new
for details on the conversion.
Source§impl ToPyObject for Cow<'_, OsStr>
impl ToPyObject for Cow<'_, OsStr>
Source§impl ToPyObject for Cow<'_, Path>
impl ToPyObject for Cow<'_, Path>
Source§impl ToPyObject for Cow<'_, [u8]>
impl ToPyObject for Cow<'_, [u8]>
Source§impl ToPyObject for IpAddr
impl ToPyObject for IpAddr
Source§impl ToPyObject for Tz
Available on Py_3_9
and crate feature chrono-tz
only.
impl ToPyObject for Tz
Available on
Py_3_9
and crate feature chrono-tz
only.Source§impl ToPyObject for bool
impl ToPyObject for bool
Converts a Rust bool
to a Python bool
.
Source§impl ToPyObject for char
impl ToPyObject for char
Source§impl ToPyObject for f32
impl ToPyObject for f32
Source§impl ToPyObject for f64
impl ToPyObject for f64
Source§impl ToPyObject for i8
impl ToPyObject for i8
Source§impl ToPyObject for i16
impl ToPyObject for i16
Source§impl ToPyObject for i32
impl ToPyObject for i32
Source§impl ToPyObject for i64
impl ToPyObject for i64
Source§impl ToPyObject for i128
Available on non-Py_LIMITED_API
and non-GraalPy
only.
impl ToPyObject for i128
Available on non-
Py_LIMITED_API
and non-GraalPy
only.Source§impl ToPyObject for isize
impl ToPyObject for isize
Source§impl ToPyObject for str
impl ToPyObject for str
Converts a Rust str
to a Python object.
See PyString::new
for details on the conversion.
Source§impl ToPyObject for u8
impl ToPyObject for u8
Source§impl ToPyObject for u16
impl ToPyObject for u16
Source§impl ToPyObject for u32
impl ToPyObject for u32
Source§impl ToPyObject for u64
impl ToPyObject for u64
Source§impl ToPyObject for u128
Available on non-Py_LIMITED_API
and non-GraalPy
only.
impl ToPyObject for u128
Available on non-
Py_LIMITED_API
and non-GraalPy
only.Source§impl ToPyObject for ()
impl ToPyObject for ()
()
is converted to Python None
.
Source§impl ToPyObject for usize
impl ToPyObject for usize
Source§impl ToPyObject for String
impl ToPyObject for String
Converts a Rust String
to a Python object.
See PyString::new
for details on the conversion.
Source§impl ToPyObject for Ipv4Addr
impl ToPyObject for Ipv4Addr
Source§impl ToPyObject for Ipv6Addr
impl ToPyObject for Ipv6Addr
Source§impl ToPyObject for Duration
impl ToPyObject for Duration
Source§impl ToPyObject for OsStr
impl ToPyObject for OsStr
Source§impl ToPyObject for OsString
impl ToPyObject for OsString
Source§impl ToPyObject for Path
impl ToPyObject for Path
Source§impl ToPyObject for PathBuf
impl ToPyObject for PathBuf
Source§impl ToPyObject for SystemTime
impl ToPyObject for SystemTime
Source§impl ToPyObject for NaiveDate
Available on crate feature chrono
only.
impl ToPyObject for NaiveDate
Available on crate feature
chrono
only.Source§impl ToPyObject for NaiveDateTime
Available on crate feature chrono
only.
impl ToPyObject for NaiveDateTime
Available on crate feature
chrono
only.Source§impl ToPyObject for NaiveTime
Available on crate feature chrono
only.
impl ToPyObject for NaiveTime
Available on crate feature
chrono
only.Source§impl ToPyObject for FixedOffset
Available on crate feature chrono
only.
impl ToPyObject for FixedOffset
Available on crate feature
chrono
only.Source§impl ToPyObject for Utc
Available on crate feature chrono
only.
impl ToPyObject for Utc
Available on crate feature
chrono
only.Source§impl ToPyObject for BigInt
Available on crate feature num-bigint
only.
impl ToPyObject for BigInt
Available on crate feature
num-bigint
only.Source§impl ToPyObject for BigUint
Available on crate feature num-bigint
only.
impl ToPyObject for BigUint
Available on crate feature
num-bigint
only.Source§impl ToPyObject for Complex<f32>
Available on crate feature num-complex
only.
impl ToPyObject for Complex<f32>
Available on crate feature
num-complex
only.Source§impl ToPyObject for Complex<f64>
Available on crate feature num-complex
only.
impl ToPyObject for Complex<f64>
Available on crate feature
num-complex
only.Source§impl ToPyObject for Ratio<i8>
Available on crate feature num-rational
only.
impl ToPyObject for Ratio<i8>
Available on crate feature
num-rational
only.Source§impl ToPyObject for Ratio<i16>
Available on crate feature num-rational
only.
impl ToPyObject for Ratio<i16>
Available on crate feature
num-rational
only.Source§impl ToPyObject for Ratio<i32>
Available on crate feature num-rational
only.
impl ToPyObject for Ratio<i32>
Available on crate feature
num-rational
only.Source§impl ToPyObject for Ratio<i64>
Available on crate feature num-rational
only.
impl ToPyObject for Ratio<i64>
Available on crate feature
num-rational
only.Source§impl ToPyObject for Ratio<isize>
Available on crate feature num-rational
only.
impl ToPyObject for Ratio<isize>
Available on crate feature
num-rational
only.Source§impl ToPyObject for Ratio<BigInt>
Available on crate feature num-rational
only.
impl ToPyObject for Ratio<BigInt>
Available on crate feature
num-rational
only.Source§impl ToPyObject for Decimal
Available on crate feature rust_decimal
only.
impl ToPyObject for Decimal
Available on crate feature
rust_decimal
only.Source§impl ToPyObject for NonZeroI8
impl ToPyObject for NonZeroI8
Source§impl ToPyObject for NonZeroI16
impl ToPyObject for NonZeroI16
Source§impl ToPyObject for NonZeroI32
impl ToPyObject for NonZeroI32
Source§impl ToPyObject for NonZeroI64
impl ToPyObject for NonZeroI64
Source§impl ToPyObject for NonZeroI128
impl ToPyObject for NonZeroI128
Source§impl ToPyObject for NonZeroIsize
impl ToPyObject for NonZeroIsize
Source§impl ToPyObject for NonZeroU8
impl ToPyObject for NonZeroU8
Source§impl ToPyObject for NonZeroU16
impl ToPyObject for NonZeroU16
Source§impl ToPyObject for NonZeroU32
impl ToPyObject for NonZeroU32
Source§impl ToPyObject for NonZeroU64
impl ToPyObject for NonZeroU64
Source§impl ToPyObject for NonZeroU128
impl ToPyObject for NonZeroU128
Source§impl ToPyObject for NonZeroUsize
impl ToPyObject for NonZeroUsize
Source§impl ToPyObject for Duration
Available on crate feature chrono
only.
impl ToPyObject for Duration
Available on crate feature
chrono
only.Source§impl<A> ToPyObject for SmallVec<A>
Available on crate feature smallvec
only.
impl<A> ToPyObject for SmallVec<A>
Available on crate feature
smallvec
only.Source§impl<K, V> ToPyObject for BTreeMap<K, V>
impl<K, V> ToPyObject for BTreeMap<K, V>
Source§impl<K, V, H> ToPyObject for HashMap<K, V, H>
impl<K, V, H> ToPyObject for HashMap<K, V, H>
Source§impl<K, V, H> ToPyObject for HashMap<K, V, H>
Available on crate feature hashbrown
only.
impl<K, V, H> ToPyObject for HashMap<K, V, H>
Available on crate feature
hashbrown
only.Source§impl<K, V, H> ToPyObject for IndexMap<K, V, H>
Available on crate feature indexmap
only.
impl<K, V, H> ToPyObject for IndexMap<K, V, H>
Available on crate feature
indexmap
only.Source§impl<L, R> ToPyObject for Either<L, R>where
L: ToPyObject,
R: ToPyObject,
Available on crate feature either
only.
impl<L, R> ToPyObject for Either<L, R>where
L: ToPyObject,
R: ToPyObject,
Available on crate feature
either
only.Source§impl<T0: ToPyObject> ToPyObject for (T0,)
impl<T0: ToPyObject> ToPyObject for (T0,)
Source§impl<T0: ToPyObject, T1: ToPyObject> ToPyObject for (T0, T1)
impl<T0: ToPyObject, T1: ToPyObject> ToPyObject for (T0, T1)
Source§impl<T0: ToPyObject, T1: ToPyObject, T2: ToPyObject> ToPyObject for (T0, T1, T2)
impl<T0: ToPyObject, T1: ToPyObject, T2: ToPyObject> ToPyObject for (T0, T1, T2)
Source§impl<T0: ToPyObject, T1: ToPyObject, T2: ToPyObject, T3: ToPyObject> ToPyObject for (T0, T1, T2, T3)
impl<T0: ToPyObject, T1: ToPyObject, T2: ToPyObject, T3: ToPyObject> ToPyObject for (T0, T1, T2, T3)
Source§impl<T0: ToPyObject, T1: ToPyObject, T2: ToPyObject, T3: ToPyObject, T4: ToPyObject> ToPyObject for (T0, T1, T2, T3, T4)
impl<T0: ToPyObject, T1: ToPyObject, T2: ToPyObject, T3: ToPyObject, T4: ToPyObject> ToPyObject for (T0, T1, T2, T3, T4)
Source§impl<T0: ToPyObject, T1: ToPyObject, T2: ToPyObject, T3: ToPyObject, T4: ToPyObject, T5: ToPyObject> ToPyObject for (T0, T1, T2, T3, T4, T5)
impl<T0: ToPyObject, T1: ToPyObject, T2: ToPyObject, T3: ToPyObject, T4: ToPyObject, T5: ToPyObject> ToPyObject for (T0, T1, T2, T3, T4, T5)
Source§impl<T0: ToPyObject, T1: ToPyObject, T2: ToPyObject, T3: ToPyObject, T4: ToPyObject, T5: ToPyObject, T6: ToPyObject> ToPyObject for (T0, T1, T2, T3, T4, T5, T6)
impl<T0: ToPyObject, T1: ToPyObject, T2: ToPyObject, T3: ToPyObject, T4: ToPyObject, T5: ToPyObject, T6: ToPyObject> ToPyObject for (T0, T1, T2, T3, T4, T5, T6)
Source§impl<T0: ToPyObject, T1: ToPyObject, T2: ToPyObject, T3: ToPyObject, T4: ToPyObject, T5: ToPyObject, T6: ToPyObject, T7: ToPyObject> ToPyObject for (T0, T1, T2, T3, T4, T5, T6, T7)
impl<T0: ToPyObject, T1: ToPyObject, T2: ToPyObject, T3: ToPyObject, T4: ToPyObject, T5: ToPyObject, T6: ToPyObject, T7: ToPyObject> ToPyObject for (T0, T1, T2, T3, T4, T5, T6, T7)
Source§impl<T0: ToPyObject, T1: ToPyObject, T2: ToPyObject, T3: ToPyObject, T4: ToPyObject, T5: ToPyObject, T6: ToPyObject, T7: ToPyObject, T8: ToPyObject> ToPyObject for (T0, T1, T2, T3, T4, T5, T6, T7, T8)
impl<T0: ToPyObject, T1: ToPyObject, T2: ToPyObject, T3: ToPyObject, T4: ToPyObject, T5: ToPyObject, T6: ToPyObject, T7: ToPyObject, T8: ToPyObject> ToPyObject for (T0, T1, T2, T3, T4, T5, T6, T7, T8)
Source§impl<T0: ToPyObject, T1: ToPyObject, T2: ToPyObject, T3: ToPyObject, T4: ToPyObject, T5: ToPyObject, T6: ToPyObject, T7: ToPyObject, T8: ToPyObject, T9: ToPyObject> ToPyObject for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
impl<T0: ToPyObject, T1: ToPyObject, T2: ToPyObject, T3: ToPyObject, T4: ToPyObject, T5: ToPyObject, T6: ToPyObject, T7: ToPyObject, T8: ToPyObject, T9: ToPyObject> ToPyObject for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
Source§impl<T0: ToPyObject, T1: ToPyObject, T2: ToPyObject, T3: ToPyObject, T4: ToPyObject, T5: ToPyObject, T6: ToPyObject, T7: ToPyObject, T8: ToPyObject, T9: ToPyObject, T10: ToPyObject> ToPyObject for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)
impl<T0: ToPyObject, T1: ToPyObject, T2: ToPyObject, T3: ToPyObject, T4: ToPyObject, T5: ToPyObject, T6: ToPyObject, T7: ToPyObject, T8: ToPyObject, T9: ToPyObject, T10: ToPyObject> ToPyObject for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)
Source§impl<T0: ToPyObject, T1: ToPyObject, T2: ToPyObject, T3: ToPyObject, T4: ToPyObject, T5: ToPyObject, T6: ToPyObject, T7: ToPyObject, T8: ToPyObject, T9: ToPyObject, T10: ToPyObject, T11: ToPyObject> ToPyObject for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)
impl<T0: ToPyObject, T1: ToPyObject, T2: ToPyObject, T3: ToPyObject, T4: ToPyObject, T5: ToPyObject, T6: ToPyObject, T7: ToPyObject, T8: ToPyObject, T9: ToPyObject, T10: ToPyObject, T11: ToPyObject> ToPyObject for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)
Source§impl<T> ToPyObject for Option<T>where
T: ToPyObject,
impl<T> ToPyObject for Option<T>where
T: ToPyObject,
Option::Some<T>
is converted like T
.
Option::None
is converted to Python None
.
Source§impl<T> ToPyObject for [T]where
T: ToPyObject,
impl<T> ToPyObject for [T]where
T: ToPyObject,
Source§impl<T> ToPyObject for BTreeSet<T>
impl<T> ToPyObject for BTreeSet<T>
Source§impl<T> ToPyObject for Vec<T>where
T: ToPyObject,
impl<T> ToPyObject for Vec<T>where
T: ToPyObject,
Source§impl<T> ToPyObject for HashSet<T>
Available on crate feature hashbrown
only.
impl<T> ToPyObject for HashSet<T>
Available on crate feature
hashbrown
only.Source§impl<T, S> ToPyObject for HashSet<T, S>
impl<T, S> ToPyObject for HashSet<T, S>
Source§impl<T, const N: usize> ToPyObject for [T; N]where
T: ToPyObject,
impl<T, const N: usize> ToPyObject for [T; N]where
T: ToPyObject,
Source§impl<T: Copy + ToPyObject> ToPyObject for Cell<T>
impl<T: Copy + ToPyObject> ToPyObject for Cell<T>
Source§impl<T: ?Sized + ToPyObject> ToPyObject for &T
impl<T: ?Sized + ToPyObject> ToPyObject for &T
Identity conversion: allows using existing PyObject
instances where
T: ToPyObject
is expected.
Source§impl<Tz: TimeZone> ToPyObject for DateTime<Tz>
Available on crate feature chrono
only.
impl<Tz: TimeZone> ToPyObject for DateTime<Tz>
Available on crate feature
chrono
only.