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 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
impl ToPyObject for i128
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
impl ToPyObject for u128
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
impl ToPyObject for NaiveDate
Source§impl ToPyObject for NaiveDateTime
impl ToPyObject for NaiveDateTime
Source§impl ToPyObject for NaiveTime
impl ToPyObject for NaiveTime
Source§impl ToPyObject for FixedOffset
impl ToPyObject for FixedOffset
Source§impl ToPyObject for Utc
impl ToPyObject for Utc
Source§impl ToPyObject for BigInt
impl ToPyObject for BigInt
Source§impl ToPyObject for BigUint
impl ToPyObject for BigUint
Source§impl ToPyObject for Complex<f32>
impl ToPyObject for Complex<f32>
Source§impl ToPyObject for Complex<f64>
impl ToPyObject for Complex<f64>
Source§impl ToPyObject for Ratio<i8>
impl ToPyObject for Ratio<i8>
Source§impl ToPyObject for Ratio<i16>
impl ToPyObject for Ratio<i16>
Source§impl ToPyObject for Ratio<i32>
impl ToPyObject for Ratio<i32>
Source§impl ToPyObject for Ratio<i64>
impl ToPyObject for Ratio<i64>
Source§impl ToPyObject for Ratio<isize>
impl ToPyObject for Ratio<isize>
Source§impl ToPyObject for Ratio<BigInt>
impl ToPyObject for Ratio<BigInt>
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
impl ToPyObject for Duration
Source§impl ToPyObject for Decimal
impl ToPyObject for Decimal
Source§impl<A> ToPyObject for SmallVec<A>where
A: Array,
A::Item: ToPyObject,
impl<A> ToPyObject for SmallVec<A>where
A: Array,
A::Item: ToPyObject,
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>
impl<K, V, H> ToPyObject for HashMap<K, V, H>
Source§impl<K, V, H> ToPyObject for IndexMap<K, V, H>
impl<K, V, H> ToPyObject for IndexMap<K, V, H>
Source§impl<L, R> ToPyObject for Either<L, R>where
L: ToPyObject,
R: ToPyObject,
impl<L, R> ToPyObject for Either<L, R>where
L: ToPyObject,
R: ToPyObject,
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>
impl<T> ToPyObject for HashSet<T>
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.