pyo3::conversion

Trait ToPyObject

Source
pub trait ToPyObject {
    // Required method
    fn to_object(&self, py: Python<'_>) -> PyObject;
}
Expand description

Conversion trait that allows various objects to be converted into PyObject.

Required Methods§

Source

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

Converts self into a Python object.

Implementations on Foreign Types§

Source§

impl ToPyObject for Cow<'_, str>

Converts a Rust Cow<'_, str> to a Python object. See PyString::new for details on the conversion.

Source§

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

Source§

impl ToPyObject for Cow<'_, OsStr>

Source§

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

Source§

impl ToPyObject for Cow<'_, [u8]>

Source§

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

Source§

impl ToPyObject for IpAddr

Source§

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

Source§

impl ToPyObject for bool

Converts a Rust bool to a Python bool.

Source§

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

Source§

impl ToPyObject for char

Source§

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

Source§

impl ToPyObject for f32

Source§

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

Source§

impl ToPyObject for f64

Source§

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

Source§

impl ToPyObject for i8

Source§

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

Source§

impl ToPyObject for i16

Source§

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

Source§

impl ToPyObject for i32

Source§

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

Source§

impl ToPyObject for i64

Source§

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

Source§

impl ToPyObject for i128

Source§

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

Source§

impl ToPyObject for isize

Source§

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

Source§

impl ToPyObject for str

Converts a Rust str to a Python object. See PyString::new for details on the conversion.

Source§

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

Source§

impl ToPyObject for u8

Source§

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

Source§

impl ToPyObject for u16

Source§

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

Source§

impl ToPyObject for u32

Source§

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

Source§

impl ToPyObject for u64

Source§

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

Source§

impl ToPyObject for u128

Source§

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

Source§

impl ToPyObject for ()

() is converted to Python None.

Source§

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

Source§

impl ToPyObject for usize

Source§

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

Source§

impl ToPyObject for String

Converts a Rust String to a Python object. See PyString::new for details on the conversion.

Source§

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

Source§

impl ToPyObject for Ipv4Addr

Source§

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

Source§

impl ToPyObject for Ipv6Addr

Source§

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

Source§

impl ToPyObject for Duration

Source§

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

Source§

impl ToPyObject for OsStr

Source§

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

Source§

impl ToPyObject for OsString

Source§

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

Source§

impl ToPyObject for Path

Source§

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

Source§

impl ToPyObject for PathBuf

Source§

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

Source§

impl ToPyObject for SystemTime

Source§

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

Source§

impl ToPyObject for NonZeroI8

Source§

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

Source§

impl ToPyObject for NonZeroI16

Source§

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

Source§

impl ToPyObject for NonZeroI32

Source§

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

Source§

impl ToPyObject for NonZeroI64

Source§

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

Source§

impl ToPyObject for NonZeroI128

Source§

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

Source§

impl ToPyObject for NonZeroIsize

Source§

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

Source§

impl ToPyObject for NonZeroU8

Source§

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

Source§

impl ToPyObject for NonZeroU16

Source§

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

Source§

impl ToPyObject for NonZeroU32

Source§

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

Source§

impl ToPyObject for NonZeroU64

Source§

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

Source§

impl ToPyObject for NonZeroU128

Source§

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

Source§

impl ToPyObject for NonZeroUsize

Source§

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

Source§

impl<'a> ToPyObject for Cow<'a, Path>

Source§

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

Source§

impl<K, V> ToPyObject for BTreeMap<K, V>
where K: Eq + ToPyObject, V: ToPyObject,

Source§

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

Source§

impl<K, V, H> ToPyObject for HashMap<K, V, H>
where K: Hash + Eq + ToPyObject, V: ToPyObject, H: BuildHasher,

Source§

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

Source§

impl<T0: ToPyObject> ToPyObject for (T0,)

Source§

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

Source§

impl<T0: ToPyObject, T1: ToPyObject> ToPyObject for (T0, T1)

Source§

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

Source§

impl<T0: ToPyObject, T1: ToPyObject, T2: ToPyObject> ToPyObject for (T0, T1, T2)

Source§

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

Source§

impl<T0: ToPyObject, T1: ToPyObject, T2: ToPyObject, T3: ToPyObject> ToPyObject for (T0, T1, T2, T3)

Source§

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

Source§

impl<T0: ToPyObject, T1: ToPyObject, T2: ToPyObject, T3: ToPyObject, T4: ToPyObject> ToPyObject for (T0, T1, T2, T3, T4)

Source§

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

Source§

impl<T0: ToPyObject, T1: ToPyObject, T2: ToPyObject, T3: ToPyObject, T4: ToPyObject, T5: ToPyObject> ToPyObject for (T0, T1, T2, T3, T4, T5)

Source§

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

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)

Source§

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

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)

Source§

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

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)

Source§

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

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)

Source§

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

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)

Source§

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

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)

Source§

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

Source§

impl<T> ToPyObject for Option<T>
where T: ToPyObject,

Option::Some<T> is converted like T. Option::None is converted to Python None.

Source§

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

Source§

impl<T> ToPyObject for [T]
where T: ToPyObject,

Source§

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

Source§

impl<T> ToPyObject for BTreeSet<T>
where T: Hash + Eq + ToPyObject,

Source§

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

Source§

impl<T> ToPyObject for Vec<T>
where T: ToPyObject,

Source§

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

Source§

impl<T, S> ToPyObject for HashSet<T, S>
where T: Hash + Eq + ToPyObject, S: BuildHasher + Default,

Source§

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

Source§

impl<T, const N: usize> ToPyObject for [T; N]
where T: ToPyObject,

Source§

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

Source§

impl<T: Copy + ToPyObject> ToPyObject for Cell<T>

Source§

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

Source§

impl<T: ?Sized + ToPyObject> ToPyObject for &T

Identity conversion: allows using existing PyObject instances where T: ToPyObject is expected.

Source§

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

Implementors§