Struct pyo3::Py[][src]

#[repr(transparent)]pub struct Py<T>(_, _);

A Python object of known type T.

Accessing this object is thread-safe, since any access to its API requires a Python<'py> GIL token. There are a few different ways to use the Python object contained:

See the guide for an explanation of the different Python object types.

Implementations

impl<T> Py<T> where
    T: PyClass
[src]

pub fn new(
    py: Python<'_>,
    value: impl Into<PyClassInitializer<T>>
) -> PyResult<Py<T>> where
    T::BaseLayout: PyBorrowFlagLayout<T::BaseType>, 
[src]

Create a new instance Py<T> of a #[pyclass] on the Python heap.

impl<T> Py<T> where
    T: PyTypeInfo
[src]

pub fn as_ref<'py>(&'py self, _py: Python<'py>) -> &'py T::AsRefTarget[src]

Borrows a GIL-bound reference to the contained T. By binding to the GIL lifetime, this allows the GIL-bound reference to not require Python for any of its methods.

For native types, this reference is &T. For pyclasses, this is &PyCell<T>.

Examples

Get access to &PyList from Py<PyList>:

let list: Py<PyList> = PyList::empty(py).into();
let list: &PyList = list.as_ref(py);
assert_eq!(list.len(), 0);

Get access to &PyCell<MyClass> from Py<MyClass>:

#[pyclass]
struct MyClass { }
let my_class: Py<MyClass> = Py::new(py, MyClass { }).unwrap();
let my_class_cell: &PyCell<MyClass> = my_class.as_ref(py);
assert!(my_class_cell.try_borrow().is_ok());

pub fn into_ref(self, py: Python<'_>) -> &T::AsRefTarget[src]

Similar to as_ref, and also consumes this Py and registers the Python object reference in PyO3's object storage. The reference count for the Python object will not be decreased until the GIL lifetime ends.

Example

Useful when returning GIL-bound references from functions. In the snippet below, note that the 'py lifetime of the input GIL lifetime is also given to the returned reference:

fn new_py_any<'py>(py: Python<'py>, value: impl IntoPy<PyObject>) -> &'py PyAny {
    let obj: PyObject = value.into_py(py);

    // .as_ref(py) would not be suitable here, because a reference to `obj` may not be
    // returned from the function.
    obj.into_ref(py)
}

impl<T> Py<T> where
    T: PyClass
[src]

pub fn borrow<'py>(&'py self, py: Python<'py>) -> PyRef<'py, T>[src]

Immutably borrows the value T. This borrow lasts untill the returned PyRef exists.

Equivalent to self.as_ref(py).borrow() - see PyCell::borrow

Panics

Panics if the value is currently mutably borrowed. For a non-panicking variant, use try_borrow.

pub fn borrow_mut<'py>(&'py self, py: Python<'py>) -> PyRefMut<'py, T>[src]

Mutably borrows the value T. This borrow lasts untill the returned PyRefMut exists.

Equivalent to self.as_ref(py).borrow_mut() - see PyCell::borrow_mut

Panics

Panics if the value is currently mutably borrowed. For a non-panicking variant, use try_borrow_mut.

pub fn try_borrow<'py>(
    &'py self,
    py: Python<'py>
) -> Result<PyRef<'py, T>, PyBorrowError>
[src]

Immutably borrows the value T, returning an error if the value is currently mutably borrowed. This borrow lasts untill the returned PyRef exists.

This is the non-panicking variant of borrow.

Equivalent to self.as_ref(py).try_borrow() - see PyCell::try_borrow

pub fn try_borrow_mut<'py>(
    &'py self,
    py: Python<'py>
) -> Result<PyRefMut<'py, T>, PyBorrowMutError>
[src]

Mutably borrows the value T, returning an error if the value is currently borrowed. This borrow lasts untill the returned PyRefMut exists.

This is the non-panicking variant of borrow_mut.

Equivalent to self.as_ref(py).try_borrow_mut() - see [PyCell::try_borrow_mut`](../pycell/struct.PyCell.html#method.try_borrow_mut)

impl<T> Py<T>[src]

pub fn get_refcnt(&self, _py: Python<'_>) -> isize[src]

Gets the reference count of the ffi::PyObject pointer.

pub fn clone_ref(&self, py: Python<'_>) -> Py<T>[src]

Clones self by calling Py_INCREF() on the ptr.

pub fn is_none(&self, _py: Python<'_>) -> bool[src]

Returns whether the object is considered to be None.

This is equivalent to the Python expression self is None.

pub fn is_true(&self, py: Python<'_>) -> PyResult<bool>[src]

Returns whether the object is considered to be true.

This is equivalent to the Python expression bool(self).

pub fn extract<'p, D>(&'p self, py: Python<'p>) -> PyResult<D> where
    D: FromPyObject<'p>, 
[src]

Extracts some type from the Python object.

This is a wrapper function around FromPyObject::extract().

pub fn getattr<N>(&self, py: Python<'_>, attr_name: N) -> PyResult<PyObject> where
    N: ToPyObject
[src]

Retrieves an attribute value.

This is equivalent to the Python expression self.attr_name.

pub fn call(
    &self,
    py: Python<'_>,
    args: impl IntoPy<Py<PyTuple>>,
    kwargs: Option<&PyDict>
) -> PyResult<PyObject>
[src]

Calls the object.

This is equivalent to the Python expression self(*args, **kwargs).

pub fn call1(
    &self,
    py: Python<'_>,
    args: impl IntoPy<Py<PyTuple>>
) -> PyResult<PyObject>
[src]

Calls the object with only positional arguments.

This is equivalent to the Python expression self(*args).

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

Calls the object without arguments.

This is equivalent to the Python expression self().

pub fn call_method(
    &self,
    py: Python<'_>,
    name: &str,
    args: impl IntoPy<Py<PyTuple>>,
    kwargs: Option<&PyDict>
) -> PyResult<PyObject>
[src]

Calls a method on the object.

This is equivalent to the Python expression self.name(*args, **kwargs).

pub fn call_method1(
    &self,
    py: Python<'_>,
    name: &str,
    args: impl IntoPy<Py<PyTuple>>
) -> PyResult<PyObject>
[src]

Calls a method on the object with only positional arguments.

This is equivalent to the Python expression self.name(*args).

pub fn call_method0(&self, py: Python<'_>, name: &str) -> PyResult<PyObject>[src]

Calls a method on the object with no arguments.

This is equivalent to the Python expression self.name().

pub unsafe fn from_owned_ptr(py: Python<'_>, ptr: *mut PyObject) -> Py<T>[src]

Create a Py<T> instance by taking ownership of the given FFI pointer.

Safety

ptr must be a pointer to a Python object of type T.

Callers must own the object referred to by ptr, as this function implicitly takes ownership of that object.

Panics

Panics if ptr is null.

pub unsafe fn from_owned_ptr_or_panic(
    py: Python<'_>,
    ptr: *mut PyObject
) -> Py<T>
[src]

👎 Deprecated:

this is a deprecated alias for Py::from_owned_ptr

Deprecated alias for from_owned_ptr.

Safety

ptr must be a pointer to a Python object of type T.

Callers must own the object referred to by ptr, as this function implicitly takes ownership of that object.

pub unsafe fn from_owned_ptr_or_err(
    py: Python<'_>,
    ptr: *mut PyObject
) -> PyResult<Py<T>>
[src]

Create a Py<T> instance by taking ownership of the given FFI pointer.

If ptr is null then the current Python exception is fetched as a PyErr.

Safety

If non-null, ptr must be a pointer to a Python object of type T.

pub unsafe fn from_owned_ptr_or_opt(
    _py: Python<'_>,
    ptr: *mut PyObject
) -> Option<Self>
[src]

Create a Py<T> instance by taking ownership of the given FFI pointer.

If ptr is null then None is returned.

Safety

If non-null, ptr must be a pointer to a Python object of type T.

pub unsafe fn from_borrowed_ptr(py: Python<'_>, ptr: *mut PyObject) -> Py<T>[src]

Create a Py<T> instance by creating a new reference from the given FFI pointer.

Safety

ptr must be a pointer to a Python object of type T.

Panics

Panics if ptr is null.

pub unsafe fn from_borrowed_ptr_or_err(
    py: Python<'_>,
    ptr: *mut PyObject
) -> PyResult<Self>
[src]

Create a Py<T> instance by creating a new reference from the given FFI pointer.

If ptr is null then the current Python exception is fetched as a PyErr.

Safety

ptr must be a pointer to a Python object of type T.

pub unsafe fn from_borrowed_ptr_or_opt(
    _py: Python<'_>,
    ptr: *mut PyObject
) -> Option<Self>
[src]

Create a Py<T> instance by creating a new reference from the given FFI pointer.

If ptr is null then None is returned.

Safety

ptr must be a pointer to a Python object of type T.

impl Py<PyAny>[src]

pub fn cast_as<'p, D>(
    &'p self,
    py: Python<'p>
) -> Result<&'p D, PyDowncastError<'_>> where
    D: PyTryFrom<'p>, 
[src]

Casts the PyObject to a concrete Python object type.

This can cast only to native Python types, not types implemented in Rust. For a more flexible alternative, see Py::extract.

Trait Implementations

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

fn as_ptr(&self) -> *mut PyObject[src]

Gets the underlying FFI pointer, returns a borrowed pointer.

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

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

impl<T> Display for Py<T> where
    T: PyTypeInfo,
    T::AsRefTarget: Display
[src]

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

Dropping a Py instance decrements the reference count on the object by 1.

impl<T> Error for Py<T> where
    T: Error + PyTypeInfo,
    T::AsRefTarget: Display
[src]

Py can be used as an error when T is an Error.

However for GIL lifetime reasons, cause() cannot be implemented for Py. Use .as_ref() to get the GIL-scoped error if you need to inspect the cause.

impl From<&'_ CancelledError> for Py<CancelledError>[src]

impl From<&'_ IncompleteReadError> for Py<IncompleteReadError>[src]

impl From<&'_ InvalidStateError> for Py<InvalidStateError>[src]

impl From<&'_ LimitOverrunError> for Py<LimitOverrunError>[src]

impl From<&'_ PanicException> for Py<PanicException>[src]

impl From<&'_ PyArithmeticError> for Py<PyArithmeticError>[src]

impl From<&'_ PyAssertionError> for Py<PyAssertionError>[src]

impl From<&'_ PyAttributeError> for Py<PyAttributeError>[src]

impl From<&'_ PyBaseException> for Py<PyBaseException>[src]

impl From<&'_ PyBlockingIOError> for Py<PyBlockingIOError>[src]

impl From<&'_ PyBool> for Py<PyBool>[src]

impl From<&'_ PyBrokenPipeError> for Py<PyBrokenPipeError>[src]

impl From<&'_ PyBufferError> for Py<PyBufferError>[src]

impl From<&'_ PyByteArray> for Py<PyByteArray>[src]

impl From<&'_ PyBytes> for Py<PyBytes>[src]

impl From<&'_ PyCFunction> for Py<PyCFunction>[src]

impl<'a, T> From<&'_ PyCell<T>> for Py<T> where
    T: PyClass
[src]

impl From<&'_ PyChildProcessError> for Py<PyChildProcessError>[src]

impl From<&'_ PyComplex> for Py<PyComplex>[src]

impl From<&'_ PyConnectionAbortedError> for Py<PyConnectionAbortedError>[src]

impl From<&'_ PyConnectionError> for Py<PyConnectionError>[src]

impl From<&'_ PyConnectionRefusedError> for Py<PyConnectionRefusedError>[src]

impl From<&'_ PyConnectionResetError> for Py<PyConnectionResetError>[src]

impl From<&'_ PyDate> for Py<PyDate>[src]

impl From<&'_ PyDateTime> for Py<PyDateTime>[src]

impl From<&'_ PyDelta> for Py<PyDelta>[src]

impl From<&'_ PyDict> for Py<PyDict>[src]

impl From<&'_ PyEOFError> for Py<PyEOFError>[src]

impl From<&'_ PyEnvironmentError> for Py<PyEnvironmentError>[src]

impl From<&'_ PyException> for Py<PyException>[src]

impl From<&'_ PyFileExistsError> for Py<PyFileExistsError>[src]

impl From<&'_ PyFileNotFoundError> for Py<PyFileNotFoundError>[src]

impl From<&'_ PyFloat> for Py<PyFloat>[src]

impl From<&'_ PyFloatingPointError> for Py<PyFloatingPointError>[src]

impl From<&'_ PyFrozenSet> for Py<PyFrozenSet>[src]

impl From<&'_ PyFunction> for Py<PyFunction>[src]

impl From<&'_ PyGeneratorExit> for Py<PyGeneratorExit>[src]

impl From<&'_ PyIOError> for Py<PyIOError>[src]

impl From<&'_ PyImportError> for Py<PyImportError>[src]

impl From<&'_ PyIndexError> for Py<PyIndexError>[src]

impl From<&'_ PyInterruptedError> for Py<PyInterruptedError>[src]

impl From<&'_ PyIsADirectoryError> for Py<PyIsADirectoryError>[src]

impl From<&'_ PyIterator> for Py<PyIterator>[src]

impl From<&'_ PyKeyError> for Py<PyKeyError>[src]

impl From<&'_ PyKeyboardInterrupt> for Py<PyKeyboardInterrupt>[src]

impl From<&'_ PyList> for Py<PyList>[src]

impl From<&'_ PyLong> for Py<PyLong>[src]

impl From<&'_ PyLookupError> for Py<PyLookupError>[src]

impl From<&'_ PyMemoryError> for Py<PyMemoryError>[src]

impl From<&'_ PyModule> for Py<PyModule>[src]

impl From<&'_ PyModuleNotFoundError> for Py<PyModuleNotFoundError>[src]

impl From<&'_ PyNameError> for Py<PyNameError>[src]

impl From<&'_ PyNotADirectoryError> for Py<PyNotADirectoryError>[src]

impl From<&'_ PyNotImplementedError> for Py<PyNotImplementedError>[src]

impl From<&'_ PyOSError> for Py<PyOSError>[src]

impl From<&'_ PyOverflowError> for Py<PyOverflowError>[src]

impl From<&'_ PyPermissionError> for Py<PyPermissionError>[src]

impl From<&'_ PyProcessLookupError> for Py<PyProcessLookupError>[src]

impl From<&'_ PyRecursionError> for Py<PyRecursionError>[src]

impl From<&'_ PyReferenceError> for Py<PyReferenceError>[src]

impl From<&'_ PyRuntimeError> for Py<PyRuntimeError>[src]

impl From<&'_ PySequence> for Py<PySequence>[src]

impl From<&'_ PySet> for Py<PySet>[src]

impl From<&'_ PySlice> for Py<PySlice>[src]

impl From<&'_ PyStopAsyncIteration> for Py<PyStopAsyncIteration>[src]

impl From<&'_ PyStopIteration> for Py<PyStopIteration>[src]

impl From<&'_ PyString> for Py<PyString>[src]

impl From<&'_ PySyntaxError> for Py<PySyntaxError>[src]

impl From<&'_ PySystemError> for Py<PySystemError>[src]

impl From<&'_ PySystemExit> for Py<PySystemExit>[src]

impl From<&'_ PyTime> for Py<PyTime>[src]

impl From<&'_ PyTimeoutError> for Py<PyTimeoutError>[src]

impl From<&'_ PyTuple> for Py<PyTuple>[src]

impl From<&'_ PyType> for Py<PyType>[src]

impl From<&'_ PyTypeError> for Py<PyTypeError>[src]

impl From<&'_ PyTzInfo> for Py<PyTzInfo>[src]

impl From<&'_ PyUnboundLocalError> for Py<PyUnboundLocalError>[src]

impl From<&'_ PyUnicodeDecodeError> for Py<PyUnicodeDecodeError>[src]

impl From<&'_ PyUnicodeEncodeError> for Py<PyUnicodeEncodeError>[src]

impl From<&'_ PyUnicodeError> for Py<PyUnicodeError>[src]

impl From<&'_ PyUnicodeTranslateError> for Py<PyUnicodeTranslateError>[src]

impl From<&'_ PyValueError> for Py<PyValueError>[src]

impl From<&'_ PyZeroDivisionError> for Py<PyZeroDivisionError>[src]

impl From<&'_ QueueEmpty> for Py<QueueEmpty>[src]

impl From<&'_ QueueFull> for Py<QueueFull>[src]

impl From<&'_ TimeoutError> for Py<TimeoutError>[src]

impl From<&'_ gaierror> for Py<gaierror>[src]

impl From<&'_ herror> for Py<herror>[src]

impl From<&'_ timeout> for Py<timeout>[src]

impl<T> From<Py<T>> for PyObject where
    T: AsRef<PyAny>, 
[src]

impl<'a, T> From<PyRef<'a, T>> for Py<T> where
    T: PyClass
[src]

impl<'a, T> From<PyRefMut<'a, T>> for Py<T> where
    T: PyClass
[src]

impl<'a, T> FromPyObject<'a> for Py<T> where
    T: PyTypeInfo,
    &'a T::AsRefTarget: FromPyObject<'a>,
    T::AsRefTarget: 'a + AsPyPointer
[src]

fn extract(ob: &'a PyAny) -> PyResult<Self>[src]

Extracts Self from the source PyObject.

impl IntoPy<Py<CancelledError>> for &CancelledError[src]

impl IntoPy<Py<IncompleteReadError>> for &IncompleteReadError[src]

impl IntoPy<Py<InvalidStateError>> for &InvalidStateError[src]

impl IntoPy<Py<LimitOverrunError>> for &LimitOverrunError[src]

impl IntoPy<Py<PanicException>> for &PanicException[src]

impl<T> IntoPy<Py<PyAny>> for Option<T> where
    T: IntoPy<PyObject>, 
[src]

impl IntoPy<Py<PyAny>> for ()[src]

impl<K, V, H> IntoPy<Py<PyAny>> for HashMap<K, V, H> where
    K: Hash + Eq + IntoPy<PyObject>,
    V: IntoPy<PyObject>,
    H: BuildHasher
[src]

impl<K, V> IntoPy<Py<PyAny>> for BTreeMap<K, V> where
    K: Eq + IntoPy<PyObject>,
    V: IntoPy<PyObject>, 
[src]

impl IntoPy<Py<PyAny>> for f64[src]

impl IntoPy<Py<PyAny>> for f32[src]

impl<T> IntoPy<Py<PyAny>> for [T; 0] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 1] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 2] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 3] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 4] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 5] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for &T where
    T: AsPyPointer
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 6] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 7] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 8] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 9] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 10] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 11] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 12] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 13] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 14] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 15] where
    T: ToPyObject
[src]

impl IntoPy<Py<PyAny>> for PyErr[src]

impl<T> IntoPy<Py<PyAny>> for [T; 16] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 17] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 18] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 19] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 20] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 21] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 22] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 23] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 24] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 25] where
    T: ToPyObject
[src]

impl<'a> IntoPy<Py<PyAny>> for &'a PyErr[src]

impl<T> IntoPy<Py<PyAny>> for [T; 26] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 27] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 28] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 29] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 30] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 31] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for [T; 32] where
    T: ToPyObject
[src]

impl<T> IntoPy<Py<PyAny>> for Vec<T> where
    T: IntoPy<PyObject>, 
[src]

impl IntoPy<Py<PyAny>> for i8[src]

impl IntoPy<Py<PyAny>> for u8[src]

impl<T> IntoPy<Py<PyAny>> for Py<T>[src]

fn into_py(self, _py: Python<'_>) -> PyObject[src]

Converts a Py instance to PyObject. Consumes self without calling Py_DECREF().

impl IntoPy<Py<PyAny>> for i16[src]

impl IntoPy<Py<PyAny>> for u16[src]

impl IntoPy<Py<PyAny>> for i32[src]

impl IntoPy<Py<PyAny>> for u32[src]

impl IntoPy<Py<PyAny>> for i64[src]

impl IntoPy<Py<PyAny>> for isize[src]

impl IntoPy<Py<PyAny>> for usize[src]

impl IntoPy<Py<PyAny>> for u64[src]

impl IntoPy<Py<PyAny>> for i128[src]

impl IntoPy<Py<PyAny>> for u128[src]

impl<T: PyClass> IntoPy<Py<PyAny>> for PyRef<'_, T>[src]

impl<K, S> IntoPy<Py<PyAny>> for HashSet<K, S> where
    K: IntoPy<PyObject> + Eq + Hash,
    S: BuildHasher + Default
[src]

impl<K> IntoPy<Py<PyAny>> for BTreeSet<K> where
    K: IntoPy<PyObject> + Ord
[src]

impl<'a> IntoPy<Py<PyAny>> for &'a str[src]

impl IntoPy<Py<PyAny>> for char[src]

impl IntoPy<Py<PyAny>> for String[src]

impl<'a> IntoPy<Py<PyAny>> for &'a String[src]

impl<A: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (A,)[src]

impl<A: IntoPy<PyObject>, B: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (A, B)[src]

impl<A: IntoPy<PyObject>, B: IntoPy<PyObject>, C: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (A, B, C)[src]

impl<A: IntoPy<PyObject>, B: IntoPy<PyObject>, C: IntoPy<PyObject>, D: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (A, B, C, D)[src]

impl<T: PyClass> IntoPy<Py<PyAny>> for PyRefMut<'_, T>[src]

impl<A: IntoPy<PyObject>, B: IntoPy<PyObject>, C: IntoPy<PyObject>, D: IntoPy<PyObject>, E: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (A, B, C, D, E)[src]

impl<A: IntoPy<PyObject>, B: IntoPy<PyObject>, C: IntoPy<PyObject>, D: IntoPy<PyObject>, E: IntoPy<PyObject>, F: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (A, B, C, D, E, F)[src]

impl<A: IntoPy<PyObject>, B: IntoPy<PyObject>, C: IntoPy<PyObject>, D: IntoPy<PyObject>, E: IntoPy<PyObject>, F: IntoPy<PyObject>, G: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (A, B, C, D, E, F, G)[src]

impl<A: IntoPy<PyObject>, B: IntoPy<PyObject>, C: IntoPy<PyObject>, D: IntoPy<PyObject>, E: IntoPy<PyObject>, F: IntoPy<PyObject>, G: IntoPy<PyObject>, H: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (A, B, C, D, E, F, G, H)[src]

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

impl IntoPy<Py<PyAny>> for bool[src]

impl<'a> IntoPy<Py<PyAny>> for &'a [u8][src]

impl IntoPy<Py<PyArithmeticError>> for &PyArithmeticError[src]

impl IntoPy<Py<PyAssertionError>> for &PyAssertionError[src]

impl IntoPy<Py<PyAttributeError>> for &PyAttributeError[src]

impl IntoPy<Py<PyBaseException>> for &PyBaseException[src]

impl IntoPy<Py<PyBlockingIOError>> for &PyBlockingIOError[src]

impl IntoPy<Py<PyBool>> for &PyBool[src]

impl IntoPy<Py<PyBrokenPipeError>> for &PyBrokenPipeError[src]

impl IntoPy<Py<PyBufferError>> for &PyBufferError[src]

impl IntoPy<Py<PyByteArray>> for &PyByteArray[src]

impl IntoPy<Py<PyBytes>> for &PyBytes[src]

impl IntoPy<Py<PyCFunction>> for &PyCFunction[src]

impl IntoPy<Py<PyChildProcessError>> for &PyChildProcessError[src]

impl IntoPy<Py<PyComplex>> for &PyComplex[src]

impl IntoPy<Py<PyConnectionAbortedError>> for &PyConnectionAbortedError[src]

impl IntoPy<Py<PyConnectionError>> for &PyConnectionError[src]

impl IntoPy<Py<PyConnectionRefusedError>> for &PyConnectionRefusedError[src]

impl IntoPy<Py<PyConnectionResetError>> for &PyConnectionResetError[src]

impl IntoPy<Py<PyDate>> for &PyDate[src]

impl IntoPy<Py<PyDateTime>> for &PyDateTime[src]

impl IntoPy<Py<PyDelta>> for &PyDelta[src]

impl IntoPy<Py<PyDict>> for &PyDict[src]

impl IntoPy<Py<PyEOFError>> for &PyEOFError[src]

impl IntoPy<Py<PyEnvironmentError>> for &PyEnvironmentError[src]

impl IntoPy<Py<PyException>> for &PyException[src]

impl IntoPy<Py<PyFileExistsError>> for &PyFileExistsError[src]

impl IntoPy<Py<PyFileNotFoundError>> for &PyFileNotFoundError[src]

impl IntoPy<Py<PyFloat>> for &PyFloat[src]

impl IntoPy<Py<PyFloatingPointError>> for &PyFloatingPointError[src]

impl IntoPy<Py<PyFrozenSet>> for &PyFrozenSet[src]

impl IntoPy<Py<PyFunction>> for &PyFunction[src]

impl IntoPy<Py<PyGeneratorExit>> for &PyGeneratorExit[src]

impl IntoPy<Py<PyIOError>> for &PyIOError[src]

impl IntoPy<Py<PyImportError>> for &PyImportError[src]

impl IntoPy<Py<PyIndexError>> for &PyIndexError[src]

impl IntoPy<Py<PyInterruptedError>> for &PyInterruptedError[src]

impl IntoPy<Py<PyIsADirectoryError>> for &PyIsADirectoryError[src]

impl IntoPy<Py<PyIterator>> for &PyIterator[src]

impl IntoPy<Py<PyKeyError>> for &PyKeyError[src]

impl IntoPy<Py<PyKeyboardInterrupt>> for &PyKeyboardInterrupt[src]

impl IntoPy<Py<PyList>> for &PyList[src]

impl IntoPy<Py<PyLong>> for &PyLong[src]

impl IntoPy<Py<PyLookupError>> for &PyLookupError[src]

impl IntoPy<Py<PyMemoryError>> for &PyMemoryError[src]

impl IntoPy<Py<PyModule>> for &PyModule[src]

impl IntoPy<Py<PyModuleNotFoundError>> for &PyModuleNotFoundError[src]

impl IntoPy<Py<PyNameError>> for &PyNameError[src]

impl IntoPy<Py<PyNotADirectoryError>> for &PyNotADirectoryError[src]

impl IntoPy<Py<PyNotImplementedError>> for &PyNotImplementedError[src]

impl IntoPy<Py<PyOSError>> for &PyOSError[src]

impl IntoPy<Py<PyOverflowError>> for &PyOverflowError[src]

impl IntoPy<Py<PyPermissionError>> for &PyPermissionError[src]

impl IntoPy<Py<PyProcessLookupError>> for &PyProcessLookupError[src]

impl IntoPy<Py<PyRecursionError>> for &PyRecursionError[src]

impl IntoPy<Py<PyReferenceError>> for &PyReferenceError[src]

impl IntoPy<Py<PyRuntimeError>> for &PyRuntimeError[src]

impl IntoPy<Py<PySequence>> for &PySequence[src]

impl IntoPy<Py<PySet>> for &PySet[src]

impl IntoPy<Py<PySlice>> for &PySlice[src]

impl IntoPy<Py<PyStopAsyncIteration>> for &PyStopAsyncIteration[src]

impl IntoPy<Py<PyStopIteration>> for &PyStopIteration[src]

impl IntoPy<Py<PyString>> for &PyString[src]

impl IntoPy<Py<PySyntaxError>> for &PySyntaxError[src]

impl IntoPy<Py<PySystemError>> for &PySystemError[src]

impl IntoPy<Py<PySystemExit>> for &PySystemExit[src]

impl IntoPy<Py<PyTime>> for &PyTime[src]

impl IntoPy<Py<PyTimeoutError>> for &PyTimeoutError[src]

impl IntoPy<Py<PyTuple>> for ()[src]

Converts () to an empty Python tuple.

impl IntoPy<Py<PyTuple>> for &PyTuple[src]

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

impl<A: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (A,)[src]

impl<A: IntoPy<PyObject>, B: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (A, B)[src]

impl<A: IntoPy<PyObject>, B: IntoPy<PyObject>, C: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (A, B, C)[src]

impl<A: IntoPy<PyObject>, B: IntoPy<PyObject>, C: IntoPy<PyObject>, D: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (A, B, C, D)[src]

impl<A: IntoPy<PyObject>, B: IntoPy<PyObject>, C: IntoPy<PyObject>, D: IntoPy<PyObject>, E: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (A, B, C, D, E)[src]

impl<A: IntoPy<PyObject>, B: IntoPy<PyObject>, C: IntoPy<PyObject>, D: IntoPy<PyObject>, E: IntoPy<PyObject>, F: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (A, B, C, D, E, F)[src]

impl<A: IntoPy<PyObject>, B: IntoPy<PyObject>, C: IntoPy<PyObject>, D: IntoPy<PyObject>, E: IntoPy<PyObject>, F: IntoPy<PyObject>, G: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (A, B, C, D, E, F, G)[src]

impl<A: IntoPy<PyObject>, B: IntoPy<PyObject>, C: IntoPy<PyObject>, D: IntoPy<PyObject>, E: IntoPy<PyObject>, F: IntoPy<PyObject>, G: IntoPy<PyObject>, H: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (A, B, C, D, E, F, G, H)[src]

impl IntoPy<Py<PyType>> for &PyType[src]

impl IntoPy<Py<PyTypeError>> for &PyTypeError[src]

impl IntoPy<Py<PyTzInfo>> for &PyTzInfo[src]

impl IntoPy<Py<PyUnboundLocalError>> for &PyUnboundLocalError[src]

impl IntoPy<Py<PyUnicodeDecodeError>> for &PyUnicodeDecodeError[src]

impl IntoPy<Py<PyUnicodeEncodeError>> for &PyUnicodeEncodeError[src]

impl IntoPy<Py<PyUnicodeError>> for &PyUnicodeError[src]

impl IntoPy<Py<PyUnicodeTranslateError>> for &PyUnicodeTranslateError[src]

impl IntoPy<Py<PyValueError>> for &PyValueError[src]

impl IntoPy<Py<PyZeroDivisionError>> for &PyZeroDivisionError[src]

impl IntoPy<Py<QueueEmpty>> for &QueueEmpty[src]

impl IntoPy<Py<QueueFull>> for &QueueFull[src]

impl IntoPy<Py<TimeoutError>> for &TimeoutError[src]

impl IntoPy<Py<gaierror>> for &gaierror[src]

impl IntoPy<Py<herror>> for &herror[src]

impl IntoPy<Py<timeout>> for &timeout[src]

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

#[must_use]fn into_ptr(self) -> *mut PyObject[src]

Gets the underlying FFI pointer, returns a owned pointer.

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

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

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

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

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

Converts Py instance -> PyObject.

Auto Trait Implementations

impl<T> RefUnwindSafe for Py<T> where
    T: RefUnwindSafe
[src]

impl<T> Unpin for Py<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for Py<T> where
    T: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.