Trait pyo3::conversion::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§
Implementations on Foreign Types§
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 ToPyObject for i128
Available on non-Py_LIMITED_API
only.
impl ToPyObject for i128
Available on non-
Py_LIMITED_API
only.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 ToPyObject for Decimal
Available on crate feature rust_decimal
only.
impl ToPyObject for Decimal
Available on crate feature
rust_decimal
only.source§impl ToPyObject for ()
impl ToPyObject for ()
()
is converted to Python None
.
source§impl ToPyObject for BigUint
Available on crate feature num-bigint
only.
impl ToPyObject for BigUint
Available on crate feature
num-bigint
only.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 ToPyObject for NaiveDateTime
Available on crate feature chrono
and non-Py_LIMITED_API
only.
impl ToPyObject for NaiveDateTime
Available on crate feature
chrono
and non-Py_LIMITED_API
only.source§impl ToPyObject for NonZeroI64
impl ToPyObject for NonZeroI64
source§impl<T> ToPyObject for Vec<T>where
T: ToPyObject,
impl<T> ToPyObject for Vec<T>where T: ToPyObject,
source§impl ToPyObject for Complex<f32>
Available on crate feature num-complex
only.
impl ToPyObject for Complex<f32>
Available on crate feature
num-complex
only.source§impl ToPyObject for Utc
Available on crate feature chrono
and non-Py_LIMITED_API
only.
impl ToPyObject for Utc
Available on crate feature
chrono
and non-Py_LIMITED_API
only.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.
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§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<K, V> ToPyObject for BTreeMap<K, V>where
K: Eq + ToPyObject,
V: ToPyObject,
impl<K, V> ToPyObject for BTreeMap<K, V>where K: Eq + ToPyObject, V: ToPyObject,
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 NonZeroU32
impl ToPyObject for NonZeroU32
source§impl ToPyObject for NonZeroIsize
impl ToPyObject for NonZeroIsize
source§impl ToPyObject for NaiveDate
Available on crate feature chrono
and non-Py_LIMITED_API
only.
impl ToPyObject for NaiveDate
Available on crate feature
chrono
and non-Py_LIMITED_API
only.source§impl ToPyObject for NonZeroI16
impl ToPyObject for NonZeroI16
source§impl<T0: ToPyObject> ToPyObject for (T0,)
impl<T0: ToPyObject> ToPyObject for (T0,)
source§impl<T: Copy + ToPyObject> ToPyObject for Cell<T>
impl<T: Copy + ToPyObject> ToPyObject for Cell<T>
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<T> ToPyObject for BTreeSet<T>where
T: Hash + Eq + ToPyObject,
impl<T> ToPyObject for BTreeSet<T>where T: Hash + Eq + ToPyObject,
source§impl ToPyObject for Complex<f64>
Available on crate feature num-complex
only.
impl ToPyObject for Complex<f64>
Available on crate feature
num-complex
only.source§impl<T, const N: usize> ToPyObject for [T; N]where
T: ToPyObject,
Available on min_const_generics
only.
impl<T, const N: usize> ToPyObject for [T; N]where T: ToPyObject,
Available on
min_const_generics
only.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 ToPyObject for NonZeroU64
impl ToPyObject for NonZeroU64
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<Tz: TimeZone> ToPyObject for DateTime<Tz>
Available on crate feature chrono
and non-Py_LIMITED_API
only.
impl<Tz: TimeZone> ToPyObject for DateTime<Tz>
Available on crate feature
chrono
and non-Py_LIMITED_API
only.source§impl ToPyObject for FixedOffset
Available on crate feature chrono
and non-Py_LIMITED_API
only.
impl ToPyObject for FixedOffset
Available on crate feature
chrono
and non-Py_LIMITED_API
only.source§impl<T, S> ToPyObject for HashSet<T, S>where
T: Hash + Eq + ToPyObject,
S: BuildHasher + Default,
impl<T, S> ToPyObject for HashSet<T, S>where T: Hash + Eq + ToPyObject, S: BuildHasher + Default,
source§impl ToPyObject for NonZeroU128
impl ToPyObject for NonZeroU128
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 ToPyObject for Duration
Available on crate feature chrono
and non-Py_LIMITED_API
only.
impl ToPyObject for Duration
Available on crate feature
chrono
and non-Py_LIMITED_API
only.source§impl ToPyObject for NonZeroUsize
impl ToPyObject for NonZeroUsize
source§impl ToPyObject for NonZeroI128
impl ToPyObject for NonZeroI128
source§impl<T> ToPyObject for HashSet<T>where
T: Hash + Eq + ToPyObject,
Available on crate feature hashbrown
only.
impl<T> ToPyObject for HashSet<T>where T: Hash + Eq + ToPyObject,
Available on crate feature
hashbrown
only.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> ToPyObject for (T0, T1)
impl<T0: ToPyObject, T1: ToPyObject> ToPyObject for (T0, T1)
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 ToPyObject for NaiveTime
Available on crate feature chrono
and non-Py_LIMITED_API
only.
impl ToPyObject for NaiveTime
Available on crate feature
chrono
and non-Py_LIMITED_API
only.source§impl ToPyObject for bool
impl ToPyObject for bool
Converts a Rust bool
to a Python bool
.
source§impl<T> ToPyObject for [T]where
T: ToPyObject,
impl<T> ToPyObject for [T]where T: ToPyObject,
source§impl<K, V, H> ToPyObject for HashMap<K, V, H>where
K: Hash + Eq + ToPyObject,
V: ToPyObject,
H: BuildHasher,
impl<K, V, H> ToPyObject for HashMap<K, V, H>where K: Hash + Eq + ToPyObject, V: ToPyObject, H: BuildHasher,
source§impl ToPyObject for NonZeroI32
impl ToPyObject for NonZeroI32
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<K, V, H> ToPyObject for HashMap<K, V, H>where
K: Hash + Eq + ToPyObject,
V: ToPyObject,
H: BuildHasher,
Available on crate feature hashbrown
only.
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§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 ToPyObject for NonZeroU16
impl ToPyObject for NonZeroU16
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.
source§impl ToPyObject for BigInt
Available on crate feature num-bigint
only.
impl ToPyObject for BigInt
Available on crate feature
num-bigint
only.source§impl ToPyObject for u128
Available on non-Py_LIMITED_API
only.
impl ToPyObject for u128
Available on non-
Py_LIMITED_API
only.Implementors§
impl ToPyObject for CancelledError
impl ToPyObject for IncompleteReadError
impl ToPyObject for InvalidStateError
impl ToPyObject for LimitOverrunError
impl ToPyObject for QueueEmpty
impl ToPyObject for QueueFull
impl ToPyObject for TimeoutError
impl ToPyObject for gaierror
impl ToPyObject for herror
impl ToPyObject for timeout
impl ToPyObject for PyArithmeticError
impl ToPyObject for PyAssertionError
impl ToPyObject for PyAttributeError
impl ToPyObject for PyBaseException
impl ToPyObject for PyBlockingIOError
impl ToPyObject for PyBrokenPipeError
impl ToPyObject for PyBufferError
impl ToPyObject for PyBytesWarning
impl ToPyObject for PyChildProcessError
impl ToPyObject for PyConnectionAbortedError
impl ToPyObject for PyConnectionError
impl ToPyObject for PyConnectionRefusedError
impl ToPyObject for PyConnectionResetError
impl ToPyObject for PyDeprecationWarning
impl ToPyObject for PyEOFError
impl ToPyObject for PyEncodingWarning
impl ToPyObject for PyEnvironmentError
impl ToPyObject for PyException
impl ToPyObject for PyFileExistsError
impl ToPyObject for PyFileNotFoundError
impl ToPyObject for PyFloatingPointError
impl ToPyObject for PyFutureWarning
impl ToPyObject for PyGeneratorExit
impl ToPyObject for PyIOError
impl ToPyObject for PyImportError
impl ToPyObject for PyImportWarning
impl ToPyObject for PyIndexError
impl ToPyObject for PyInterruptedError
impl ToPyObject for PyIsADirectoryError
impl ToPyObject for PyKeyError
impl ToPyObject for PyKeyboardInterrupt
impl ToPyObject for PyLookupError
impl ToPyObject for PyMemoryError
impl ToPyObject for PyModuleNotFoundError
impl ToPyObject for PyNameError
impl ToPyObject for PyNotADirectoryError
impl ToPyObject for PyNotImplementedError
impl ToPyObject for PyOSError
impl ToPyObject for PyOverflowError
impl ToPyObject for PyPendingDeprecationWarning
impl ToPyObject for PyPermissionError
impl ToPyObject for PyProcessLookupError
impl ToPyObject for PyRecursionError
impl ToPyObject for PyReferenceError
impl ToPyObject for PyResourceWarning
impl ToPyObject for PyRuntimeError
impl ToPyObject for PyRuntimeWarning
impl ToPyObject for PyStopAsyncIteration
impl ToPyObject for PyStopIteration
impl ToPyObject for PySyntaxError
impl ToPyObject for PySyntaxWarning
impl ToPyObject for PySystemError
impl ToPyObject for PySystemExit
impl ToPyObject for PyTimeoutError
impl ToPyObject for PyTypeError
impl ToPyObject for PyUnboundLocalError
impl ToPyObject for PyUnicodeDecodeError
impl ToPyObject for PyUnicodeEncodeError
impl ToPyObject for PyUnicodeError
impl ToPyObject for PyUnicodeTranslateError
impl ToPyObject for PyUnicodeWarning
impl ToPyObject for PyUserWarning
impl ToPyObject for PyValueError
impl ToPyObject for PyWarning
impl ToPyObject for PyZeroDivisionError
impl ToPyObject for PanicException
impl ToPyObject for PyErr
impl ToPyObject for PyAny
impl ToPyObject for PyBool
impl ToPyObject for PyByteArray
impl ToPyObject for PyBytes
impl ToPyObject for PyCFunction
impl ToPyObject for PyCapsule
impl ToPyObject for PyCode
Available on non-
Py_LIMITED_API
only.impl ToPyObject for PyComplex
impl ToPyObject for PyDate
Available on non-
Py_LIMITED_API
only.impl ToPyObject for PyDateTime
Available on non-
Py_LIMITED_API
only.impl ToPyObject for PyDelta
Available on non-
Py_LIMITED_API
only.impl ToPyObject for PyDict
impl ToPyObject for PyDictItems
impl ToPyObject for PyDictKeys
impl ToPyObject for PyDictValues
impl ToPyObject for PyFloat
impl ToPyObject for PyFrame
Available on non-
Py_LIMITED_API
and non-PyPy
only.impl ToPyObject for PyFrozenSet
impl ToPyObject for PyFunction
impl ToPyObject for PyIterator
impl ToPyObject for PyList
impl ToPyObject for PyLong
impl ToPyObject for PyMapping
impl ToPyObject for PyModule
impl ToPyObject for PySequence
impl ToPyObject for PySet
impl ToPyObject for PySlice
impl ToPyObject for PySliceIndices
impl ToPyObject for PyString
impl ToPyObject for PySuper
Available on non-
PyPy
only.impl ToPyObject for PyTime
Available on non-
Py_LIMITED_API
only.impl ToPyObject for PyTraceback
impl ToPyObject for PyTuple
impl ToPyObject for PyType
impl ToPyObject for PyTzInfo
Available on non-
Py_LIMITED_API
only.