[][src]Struct pyo3::Py

#[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.

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.

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<&'_ 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 IntoPy<Py<PyAny>> for Complex<f32>[src]

impl IntoPy<Py<PyAny>> for Complex<f64>[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 where
    T: AsPyPointer
[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; 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 IntoPy<Py<PyAny>> for PyErr[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<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<'a> IntoPy<Py<PyAny>> for &'a PyErr[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<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<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 i8[src]

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

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<'_, T: PyClass> IntoPy<Py<PyAny>> for PyRef<'_, T>[src]

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

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

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

impl IntoPy<Py<PyAny>> for BigInt[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 String[src]

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

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

impl<'_, T: PyClass> IntoPy<Py<PyAny>> for PyRefMut<'_, T>[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<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<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

impl<T> Unpin for Py<T> where
    T: Unpin

impl<T> UnwindSafe for Py<T> where
    T: UnwindSafe

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<'a, T> FromPyObject<'a> for T where
    T: PyClass + Clone
[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.