Trait ToPyObject
pub trait ToPyObject {
// Required method
fn to_object(&self, py: Python<'_>) -> Py<PyAny>;
}
👎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.Available on crate features
dep_pyo3
and std
only.Expand description
Conversion trait that allows various objects to be converted into PyObject
.
Required Methods§
Implementations on Foreign Types§
§impl ToPyObject for bool
Converts a Rust bool
to a Python bool
.
impl ToPyObject for bool
Converts a Rust bool
to a Python bool
.
§impl ToPyObject for char
impl ToPyObject for char
§impl ToPyObject for f32
impl ToPyObject for f32
§impl ToPyObject for f64
impl ToPyObject for f64
§impl ToPyObject for i8
impl ToPyObject for i8
§impl ToPyObject for i16
impl ToPyObject for i16
§impl ToPyObject for i32
impl ToPyObject for i32
§impl ToPyObject for i64
impl ToPyObject for i64
§impl ToPyObject for i128
impl ToPyObject for i128
§impl ToPyObject for isize
impl ToPyObject for isize
§impl ToPyObject for str
Converts a Rust str
to a Python object.
See PyString::new
for details on the conversion.
impl ToPyObject for str
Converts a Rust str
to a Python object.
See PyString::new
for details on the conversion.
§impl ToPyObject for u8
impl ToPyObject for u8
§impl ToPyObject for u16
impl ToPyObject for u16
§impl ToPyObject for u32
impl ToPyObject for u32
§impl ToPyObject for u64
impl ToPyObject for u64
§impl ToPyObject for u128
impl ToPyObject for u128
§impl ToPyObject for ()
()
is converted to Python None
.
impl ToPyObject for ()
()
is converted to Python None
.
§impl ToPyObject for usize
impl ToPyObject for usize
§impl<T0> ToPyObject for (T0,)where
T0: ToPyObject,
impl<T0> ToPyObject for (T0,)where
T0: ToPyObject,
§impl<T0, T1> ToPyObject for (T0, T1)where
T0: ToPyObject,
T1: ToPyObject,
impl<T0, T1> ToPyObject for (T0, T1)where
T0: ToPyObject,
T1: ToPyObject,
§impl<T0, T1, T2> ToPyObject for (T0, T1, T2)
impl<T0, T1, T2> ToPyObject for (T0, T1, T2)
§impl<T0, T1, T2, T3> ToPyObject for (T0, T1, T2, T3)
impl<T0, T1, T2, T3> ToPyObject for (T0, T1, T2, T3)
§impl<T0, T1, T2, T3, T4> ToPyObject for (T0, T1, T2, T3, T4)
impl<T0, T1, T2, T3, T4> ToPyObject for (T0, T1, T2, T3, T4)
§impl<T0, T1, T2, T3, T4, T5> ToPyObject for (T0, T1, T2, T3, T4, T5)where
T0: ToPyObject,
T1: ToPyObject,
T2: ToPyObject,
T3: ToPyObject,
T4: ToPyObject,
T5: ToPyObject,
impl<T0, T1, T2, T3, T4, T5> ToPyObject for (T0, T1, T2, T3, T4, T5)where
T0: ToPyObject,
T1: ToPyObject,
T2: ToPyObject,
T3: ToPyObject,
T4: ToPyObject,
T5: ToPyObject,
§impl<T0, T1, T2, T3, T4, T5, T6> ToPyObject for (T0, T1, T2, T3, T4, T5, T6)where
T0: ToPyObject,
T1: ToPyObject,
T2: ToPyObject,
T3: ToPyObject,
T4: ToPyObject,
T5: ToPyObject,
T6: ToPyObject,
impl<T0, T1, T2, T3, T4, T5, T6> ToPyObject for (T0, T1, T2, T3, T4, T5, T6)where
T0: ToPyObject,
T1: ToPyObject,
T2: ToPyObject,
T3: ToPyObject,
T4: ToPyObject,
T5: ToPyObject,
T6: ToPyObject,
§impl<T0, T1, T2, T3, T4, T5, T6, T7> ToPyObject for (T0, T1, T2, T3, T4, T5, T6, T7)where
T0: ToPyObject,
T1: ToPyObject,
T2: ToPyObject,
T3: ToPyObject,
T4: ToPyObject,
T5: ToPyObject,
T6: ToPyObject,
T7: ToPyObject,
impl<T0, T1, T2, T3, T4, T5, T6, T7> ToPyObject for (T0, T1, T2, T3, T4, T5, T6, T7)where
T0: ToPyObject,
T1: ToPyObject,
T2: ToPyObject,
T3: ToPyObject,
T4: ToPyObject,
T5: ToPyObject,
T6: ToPyObject,
T7: ToPyObject,
§impl<T0, T1, T2, T3, T4, T5, T6, T7, T8> ToPyObject for (T0, T1, T2, T3, T4, T5, T6, T7, T8)where
T0: ToPyObject,
T1: ToPyObject,
T2: ToPyObject,
T3: ToPyObject,
T4: ToPyObject,
T5: ToPyObject,
T6: ToPyObject,
T7: ToPyObject,
T8: ToPyObject,
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8> ToPyObject for (T0, T1, T2, T3, T4, T5, T6, T7, T8)where
T0: ToPyObject,
T1: ToPyObject,
T2: ToPyObject,
T3: ToPyObject,
T4: ToPyObject,
T5: ToPyObject,
T6: ToPyObject,
T7: ToPyObject,
T8: ToPyObject,
§impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> ToPyObject for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)where
T0: ToPyObject,
T1: ToPyObject,
T2: ToPyObject,
T3: ToPyObject,
T4: ToPyObject,
T5: ToPyObject,
T6: ToPyObject,
T7: ToPyObject,
T8: ToPyObject,
T9: ToPyObject,
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> ToPyObject for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)where
T0: ToPyObject,
T1: ToPyObject,
T2: ToPyObject,
T3: ToPyObject,
T4: ToPyObject,
T5: ToPyObject,
T6: ToPyObject,
T7: ToPyObject,
T8: ToPyObject,
T9: ToPyObject,
§impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> ToPyObject for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)where
T0: ToPyObject,
T1: ToPyObject,
T2: ToPyObject,
T3: ToPyObject,
T4: ToPyObject,
T5: ToPyObject,
T6: ToPyObject,
T7: ToPyObject,
T8: ToPyObject,
T9: ToPyObject,
T10: ToPyObject,
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> ToPyObject for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)where
T0: ToPyObject,
T1: ToPyObject,
T2: ToPyObject,
T3: ToPyObject,
T4: ToPyObject,
T5: ToPyObject,
T6: ToPyObject,
T7: ToPyObject,
T8: ToPyObject,
T9: ToPyObject,
T10: ToPyObject,
§impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> ToPyObject for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)where
T0: ToPyObject,
T1: ToPyObject,
T2: ToPyObject,
T3: ToPyObject,
T4: ToPyObject,
T5: ToPyObject,
T6: ToPyObject,
T7: ToPyObject,
T8: ToPyObject,
T9: ToPyObject,
T10: ToPyObject,
T11: ToPyObject,
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> ToPyObject for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)where
T0: ToPyObject,
T1: ToPyObject,
T2: ToPyObject,
T3: ToPyObject,
T4: ToPyObject,
T5: ToPyObject,
T6: ToPyObject,
T7: ToPyObject,
T8: ToPyObject,
T9: ToPyObject,
T10: ToPyObject,
T11: ToPyObject,
§impl<T> ToPyObject for &Twhere
T: ToPyObject + ?Sized,
Identity conversion: allows using existing PyObject
instances where
T: ToPyObject
is expected.
impl<T> ToPyObject for &Twhere
T: ToPyObject + ?Sized,
Identity conversion: allows using existing PyObject
instances where
T: ToPyObject
is expected.
§impl<T> ToPyObject for [T]where
T: ToPyObject,
impl<T> ToPyObject for [T]where
T: ToPyObject,
§impl<T, const N: usize> ToPyObject for [T; N]where
T: ToPyObject,
impl<T, const N: usize> ToPyObject for [T; N]where
T: ToPyObject,
Implementors§
impl ToPyObject for IpAddr
impl ToPyObject for Cow<'_, str>
Converts a Rust Cow<'_, str>
to a Python object.
See PyString::new
for details on the conversion.
impl ToPyObject for Cow<'_, Path>
impl ToPyObject for Cow<'_, OsStr>
impl ToPyObject for Cow<'_, [u8]>
impl ToPyObject for Ipv4Addr
impl ToPyObject for Ipv6Addr
impl ToPyObject for NonZero<i8>
impl ToPyObject for NonZero<i16>
impl ToPyObject for NonZero<i32>
impl ToPyObject for NonZero<i64>
impl ToPyObject for NonZero<i128>
impl ToPyObject for NonZero<isize>
impl ToPyObject for NonZero<u8>
impl ToPyObject for NonZero<u16>
impl ToPyObject for NonZero<u32>
impl ToPyObject for NonZero<u64>
impl ToPyObject for NonZero<u128>
impl ToPyObject for NonZero<usize>
impl ToPyObject for Path
impl ToPyObject for PathBuf
impl ToPyObject for String
Converts a Rust String
to a Python object.
See PyString::new
for details on the conversion.
impl ToPyObject for OsStr
impl ToPyObject for OsString
impl ToPyObject for Duration
impl ToPyObject for SystemTime
impl ToPyObject for PyBackedBytes
impl ToPyObject for PyBackedStr
impl ToPyObject for PyErr
impl ToPyObject for PySliceIndices
impl<K, V> ToPyObject for BTreeMap<K, V>
impl<K, V, H> ToPyObject for devela::all::HashMap<K, V, H>
impl<K, V, H> ToPyObject for devela::_dep::_std::collections::HashMap<K, V, H>
impl<T> ToPyObject for Option<T>where
T: ToPyObject,
Option::Some<T>
is converted like T
.
Option::None
is converted to Python None
.