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 Path

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<'a> ToPyObject for Cow<'a, Path>

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 i128

Available on non-Py_LIMITED_API only.
source§

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

source§

impl ToPyObject for i8

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 ToPyObject for Decimal

Available on crate feature rust_decimal only.
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 BigUint

Available on crate feature num-bigint only.
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 ToPyObject for Ipv4Addr

source§

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

source§

impl ToPyObject for NaiveDateTime

Available on crate feature chrono and non-Py_LIMITED_API only.
source§

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

source§

impl ToPyObject for NonZeroI64

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 ToPyObject for PathBuf

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 Complex<f32>

Available on crate feature num-complex only.
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 Utc

Available on crate feature chrono and non-Py_LIMITED_API only.
source§

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

source§

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

Available on crate feature indexmap only.
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 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<K, V> ToPyObject for BTreeMap<K, V>where K: Eq + ToPyObject, V: ToPyObject,

source§

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

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 NonZeroU32

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 f64

source§

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

source§

impl ToPyObject for NaiveDate

Available on crate feature chrono and non-Py_LIMITED_API only.
source§

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

source§

impl ToPyObject for NonZeroI16

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<T: Copy + ToPyObject> ToPyObject for Cell<T>

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 char

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<T> ToPyObject for BTreeSet<T>where T: Hash + Eq + ToPyObject,

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 Complex<f64>

Available on crate feature num-complex only.
source§

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

source§

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

Available on min_const_generics only.
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 ToPyObject for NonZeroU64

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<Tz: TimeZone> ToPyObject for DateTime<Tz>

Available on crate feature chrono and non-Py_LIMITED_API only.
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 i32

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 Cow<'_, OsStr>

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 i64

source§

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

source§

impl ToPyObject for FixedOffset

Available on crate feature chrono and non-Py_LIMITED_API only.
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 ToPyObject for NonZeroU128

source§

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

source§

impl ToPyObject for IpAddr

source§

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

source§

impl ToPyObject for i16

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 ToPyObject for OsStr

source§

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

source§

impl ToPyObject for Duration

Available on crate feature chrono and non-Py_LIMITED_API only.
source§

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

source§

impl ToPyObject for NonZeroUsize

source§

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

source§

impl ToPyObject for NonZeroI128

source§

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

source§

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

Available on crate feature hashbrown only.
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> ToPyObject for (T0, T1)

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 ToPyObject for OsString

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 NaiveTime

Available on crate feature chrono and non-Py_LIMITED_API only.
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<T> ToPyObject for [T]where T: ToPyObject,

source§

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

source§

impl ToPyObject for f32

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 ToPyObject for NonZeroI32

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<K, V, H> ToPyObject for HashMap<K, V, H>where K: Hash + Eq + ToPyObject, V: ToPyObject, H: BuildHasher,

Available on crate feature hashbrown only.
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 ToPyObject for NonZeroU16

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

source§

impl ToPyObject for BigInt

Available on crate feature num-bigint only.
source§

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

source§

impl ToPyObject for u128

Available on non-Py_LIMITED_API only.
source§

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

Implementors§

source§

impl ToPyObject for CancelledError

source§

impl ToPyObject for IncompleteReadError

source§

impl ToPyObject for InvalidStateError

source§

impl ToPyObject for LimitOverrunError

source§

impl ToPyObject for QueueEmpty

source§

impl ToPyObject for QueueFull

source§

impl ToPyObject for TimeoutError

source§

impl ToPyObject for gaierror

source§

impl ToPyObject for herror

source§

impl ToPyObject for timeout

source§

impl ToPyObject for PyArithmeticError

source§

impl ToPyObject for PyAssertionError

source§

impl ToPyObject for PyAttributeError

source§

impl ToPyObject for PyBaseException

source§

impl ToPyObject for PyBlockingIOError

source§

impl ToPyObject for PyBrokenPipeError

source§

impl ToPyObject for PyBufferError

source§

impl ToPyObject for PyBytesWarning

source§

impl ToPyObject for PyChildProcessError

source§

impl ToPyObject for PyConnectionAbortedError

source§

impl ToPyObject for PyConnectionError

source§

impl ToPyObject for PyConnectionRefusedError

source§

impl ToPyObject for PyConnectionResetError

source§

impl ToPyObject for PyDeprecationWarning

source§

impl ToPyObject for PyEOFError

source§

impl ToPyObject for PyEncodingWarning

source§

impl ToPyObject for PyEnvironmentError

source§

impl ToPyObject for PyException

source§

impl ToPyObject for PyFileExistsError

source§

impl ToPyObject for PyFileNotFoundError

source§

impl ToPyObject for PyFloatingPointError

source§

impl ToPyObject for PyFutureWarning

source§

impl ToPyObject for PyGeneratorExit

source§

impl ToPyObject for PyIOError

source§

impl ToPyObject for PyImportError

source§

impl ToPyObject for PyImportWarning

source§

impl ToPyObject for PyIndexError

source§

impl ToPyObject for PyInterruptedError

source§

impl ToPyObject for PyIsADirectoryError

source§

impl ToPyObject for PyKeyError

source§

impl ToPyObject for PyKeyboardInterrupt

source§

impl ToPyObject for PyLookupError

source§

impl ToPyObject for PyMemoryError

source§

impl ToPyObject for PyModuleNotFoundError

source§

impl ToPyObject for PyNameError

source§

impl ToPyObject for PyNotADirectoryError

source§

impl ToPyObject for PyNotImplementedError

source§

impl ToPyObject for PyOSError

source§

impl ToPyObject for PyOverflowError

source§

impl ToPyObject for PyPendingDeprecationWarning

source§

impl ToPyObject for PyPermissionError

source§

impl ToPyObject for PyProcessLookupError

source§

impl ToPyObject for PyRecursionError

source§

impl ToPyObject for PyReferenceError

source§

impl ToPyObject for PyResourceWarning

source§

impl ToPyObject for PyRuntimeError

source§

impl ToPyObject for PyRuntimeWarning

source§

impl ToPyObject for PyStopAsyncIteration

source§

impl ToPyObject for PyStopIteration

source§

impl ToPyObject for PySyntaxError

source§

impl ToPyObject for PySyntaxWarning

source§

impl ToPyObject for PySystemError

source§

impl ToPyObject for PySystemExit

source§

impl ToPyObject for PyTimeoutError

source§

impl ToPyObject for PyTypeError

source§

impl ToPyObject for PyUnboundLocalError

source§

impl ToPyObject for PyUnicodeDecodeError

source§

impl ToPyObject for PyUnicodeEncodeError

source§

impl ToPyObject for PyUnicodeError

source§

impl ToPyObject for PyUnicodeTranslateError

source§

impl ToPyObject for PyUnicodeWarning

source§

impl ToPyObject for PyUserWarning

source§

impl ToPyObject for PyValueError

source§

impl ToPyObject for PyWarning

source§

impl ToPyObject for PyZeroDivisionError

source§

impl ToPyObject for PanicException

source§

impl ToPyObject for PyErr

source§

impl ToPyObject for PyAny

source§

impl ToPyObject for PyBool

source§

impl ToPyObject for PyByteArray

source§

impl ToPyObject for PyBytes

source§

impl ToPyObject for PyCFunction

source§

impl ToPyObject for PyCapsule

source§

impl ToPyObject for PyCode

Available on non-Py_LIMITED_API only.
source§

impl ToPyObject for PyComplex

source§

impl ToPyObject for PyDate

Available on non-Py_LIMITED_API only.
source§

impl ToPyObject for PyDateTime

Available on non-Py_LIMITED_API only.
source§

impl ToPyObject for PyDelta

Available on non-Py_LIMITED_API only.
source§

impl ToPyObject for PyDict

source§

impl ToPyObject for PyDictItems

source§

impl ToPyObject for PyDictKeys

source§

impl ToPyObject for PyDictValues

source§

impl ToPyObject for PyFloat

source§

impl ToPyObject for PyFrame

Available on non-Py_LIMITED_API and non-PyPy only.
source§

impl ToPyObject for PyFrozenSet

source§

impl ToPyObject for PyFunction

source§

impl ToPyObject for PyIterator

source§

impl ToPyObject for PyList

source§

impl ToPyObject for PyLong

source§

impl ToPyObject for PyMapping

source§

impl ToPyObject for PyModule

source§

impl ToPyObject for PySequence

source§

impl ToPyObject for PySet

source§

impl ToPyObject for PySlice

source§

impl ToPyObject for PySliceIndices

source§

impl ToPyObject for PyString

source§

impl ToPyObject for PySuper

Available on non-PyPy only.
source§

impl ToPyObject for PyTime

Available on non-Py_LIMITED_API only.
source§

impl ToPyObject for PyTraceback

source§

impl ToPyObject for PyTuple

source§

impl ToPyObject for PyType

source§

impl ToPyObject for PyTzInfo

Available on non-Py_LIMITED_API only.
source§

impl<T> ToPyObject for Py<T>

source§

impl<T: PyClass> ToPyObject for &PyCell<T>