[][src]Trait pyo3::conversion::ToPyObject

pub trait ToPyObject {
    fn to_object(&self, py: Python<'_>) -> PyObject;
}

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

Required methods

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

Converts self into a Python object.

Loading content...

Implementations on Foreign Types

impl<'a, T: ?Sized> ToPyObject for &'a T where
    T: ToPyObject
[src]

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

impl<T> ToPyObject for Option<T> where
    T: ToPyObject
[src]

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

impl ToPyObject for ()[src]

() is converted to Python None.

impl ToPyObject for bool[src]

Converts a Rust bool to a Python bool.

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

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

impl ToPyObject for f64[src]

impl ToPyObject for f32[src]

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

impl<T> ToPyObject for Vec<T> where
    T: ToPyObject
[src]

impl ToPyObject for i8[src]

impl ToPyObject for u8[src]

impl ToPyObject for i16[src]

impl ToPyObject for u16[src]

impl ToPyObject for i32[src]

impl ToPyObject for u32[src]

impl ToPyObject for i64[src]

impl ToPyObject for isize[src]

impl ToPyObject for usize[src]

impl ToPyObject for u64[src]

impl ToPyObject for i128[src]

impl ToPyObject for u128[src]

impl<T> ToPyObject for HashSet<T> where
    T: Hash + Eq + ToPyObject
[src]

impl<T> ToPyObject for BTreeSet<T> where
    T: Hash + Eq + ToPyObject
[src]

impl ToPyObject for str[src]

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

impl<'a> ToPyObject for Cow<'a, str>[src]

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

impl ToPyObject for String[src]

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

impl<A: ToPyObject> ToPyObject for (A,)[src]

impl<A: ToPyObject, B: ToPyObject> ToPyObject for (A, B)[src]

impl<A: ToPyObject, B: ToPyObject, C: ToPyObject> ToPyObject for (A, B, C)[src]

impl<A: ToPyObject, B: ToPyObject, C: ToPyObject, D: ToPyObject> ToPyObject for (A, B, C, D)[src]

impl<A: ToPyObject, B: ToPyObject, C: ToPyObject, D: ToPyObject, E: ToPyObject> ToPyObject for (A, B, C, D, E)[src]

impl<A: ToPyObject, B: ToPyObject, C: ToPyObject, D: ToPyObject, E: ToPyObject, F: ToPyObject> ToPyObject for (A, B, C, D, E, F)[src]

impl<A: ToPyObject, B: ToPyObject, C: ToPyObject, D: ToPyObject, E: ToPyObject, F: ToPyObject, G: ToPyObject> ToPyObject for (A, B, C, D, E, F, G)[src]

impl<A: ToPyObject, B: ToPyObject, C: ToPyObject, D: ToPyObject, E: ToPyObject, F: ToPyObject, G: ToPyObject, H: ToPyObject> ToPyObject for (A, B, C, D, E, F, G, H)[src]

impl<A: ToPyObject, B: ToPyObject, C: ToPyObject, D: ToPyObject, E: ToPyObject, F: ToPyObject, G: ToPyObject, H: ToPyObject, I: ToPyObject> ToPyObject for (A, B, C, D, E, F, G, H, I)[src]

Loading content...

Implementors

impl ToPyObject for PyModule[src]

impl ToPyObject for PyAny[src]

impl ToPyObject for PyErr[src]

impl ToPyObject for PyObject[src]

impl ToPyObject for PyBool[src]

impl ToPyObject for PyByteArray[src]

impl ToPyObject for PyBytes[src]

impl ToPyObject for PyComplex[src]

impl ToPyObject for PyDate[src]

impl ToPyObject for PyDateTime[src]

impl ToPyObject for PyDelta[src]

impl ToPyObject for PyDict[src]

impl ToPyObject for PyFloat[src]

impl ToPyObject for PyFrozenSet[src]

impl ToPyObject for PyList[src]

impl ToPyObject for PyLong[src]

impl ToPyObject for PySet[src]

impl ToPyObject for PySlice[src]

impl ToPyObject for PySliceIndices[src]

impl ToPyObject for PyString[src]

impl ToPyObject for PyTime[src]

impl ToPyObject for PyTuple[src]

impl ToPyObject for PyType[src]

impl ToPyObject for PyTzInfo[src]

impl<T> ToPyObject for Py<T>[src]

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

Converts Py instance -> PyObject.

impl<T: PyClass, '_> ToPyObject for &'_ PyCell<T>[src]

Loading content...