Struct pyo3::Py

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

A GIL-independent reference to an object allocated on the Python heap.

This type does not auto-dereference to the inner object because you must prove you hold the GIL to access it. Instead, call one of its methods to access the inner object:

Example: Storing Python objects in structs

As all the native Python objects only appear as references, storing them in structs doesn’t work well. For example, this won’t compile:

#[pyclass]
struct Foo<'py> {
    inner: &'py PyDict,
}

impl Foo {
    fn new() -> Foo {
        let foo = Python::with_gil(|py| {
            // `py` will only last for this scope.

            // `&PyDict` derives its lifetime from `py` and
            // so won't be able to outlive this closure.
            let dict: &PyDict = PyDict::new(py);

            // because `Foo` contains `dict` its lifetime
            // is now also tied to `py`.
            Foo { inner: dict }
        });
        // Foo is no longer valid.
        // Returning it from this function is a 💥 compiler error 💥
        foo
    }
}

Py<T> can be used to get around this by converting dict into a GIL-independent reference:

use pyo3::prelude::*;
use pyo3::types::PyDict;

#[pyclass]
struct Foo {
    inner: Py<PyDict>,
}

#[pymethods]
impl Foo {
    #[new]
    fn __new__() -> Foo {
        Python::with_gil(|py| {
            let dict: Py<PyDict> = PyDict::new(py).into();
            Foo { inner: dict }
        })
    }
}

This can also be done with other pyclasses:

use pyo3::prelude::*;

#[pyclass]
struct Bar {/* ... */}

#[pyclass]
struct Foo {
    inner: Py<Bar>,
}

#[pymethods]
impl Foo {
    #[new]
    fn __new__() -> PyResult<Foo> {
        Python::with_gil(|py| {
            let bar: Py<Bar> = Py::new(py, Bar {})?;
            Ok(Foo { inner: bar })
        })
    }
}

Example: Shared ownership of Python objects

Py<T> can be used to share ownership of a Python object, similar to std’s Rc<T>. As with Rc<T>, cloning it increases its reference count rather than duplicating the underlying object.

This can be done using either Py::clone_ref or Py<T>’s Clone trait implementation. Py::clone_ref will be faster if you happen to be already holding the GIL.

use pyo3::prelude::*;
use pyo3::types::PyDict;

Python::with_gil(|py| {
    let first: Py<PyDict> = PyDict::new(py).into();

    // All of these are valid syntax
    let second = Py::clone_ref(&first, py);
    let third = first.clone_ref(py);
    let fourth = Py::clone(&first);
    let fifth = first.clone();

    // Disposing of our original `Py<PyDict>` just decrements the reference count.
    drop(first);

    // They all point to the same object
    assert!(second.is(&third));
    assert!(fourth.is(&fifth));
    assert!(second.is(&fourth));
});

Preventing reference cycles

It is easy to accidentally create reference cycles using Py<T>. The Python interpreter can break these reference cycles within pyclasses if they integrate with the garbage collector. If your pyclass contains other Python objects you should implement it to avoid leaking memory.

A note on Python reference counts

Dropping a Py<T> will eventually decrease Python’s reference count of the pointed-to variable, allowing Python’s garbage collector to free the associated memory, but this may not happen immediately. This is because a Py<T> can be dropped at any time, but the Python reference count can only be modified when the GIL is held.

If a Py<T> is dropped while its thread happens to be holding the GIL then the Python reference count will be decreased immediately. Otherwise, the reference count will be decreased the next time the GIL is reacquired.

A note on Send and Sync

Accessing this object is threadsafe, since any access to its API requires a Python<'py> token. As you can only get this by acquiring the GIL, Py<...> “implements Send and Sync.

Implementations§

source§

impl<T> Py<T>where T: PyClass,

source

pub fn new( py: Python<'_>, value: impl Into<PyClassInitializer<T>> ) -> PyResult<Py<T>>

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

Examples
use pyo3::prelude::*;

#[pyclass]
struct Foo {/* fields omitted */}

Python::with_gil(|py| -> PyResult<Py<Foo>> {
    let foo: Py<Foo> = Py::new(py, Foo {})?;
    Ok(foo)
})?;
source§

impl<T> Py<T>where T: PyTypeInfo,

source

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

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<'py> for any of its methods, which makes calling methods on it more ergonomic.

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

Note that the lifetime of the returned reference is the shortest of &self and Python<'py>. Consider using Py::into_ref instead if this poses a problem.

Examples

Get access to &PyList from Py<PyList>:

Python::with_gil(|py| {
    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 {}

Python::with_gil(|py| {
    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());
});
source

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

Borrows a GIL-bound reference to the contained T independently of the lifetime of T.

This method is similar to as_ref but consumes self 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.

You should prefer using as_ref if you can as it’ll have less overhead.

Examples

Py::as_ref’s lifetime limitation forbids creating a function that references a variable created inside the function.

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

    // The lifetime of the return value of this function is the shortest
    // of `obj` and `py`. As `obj` is owned by the current function,
    // Rust won't let the return value escape this function!
    obj.as_ref(py)
}

This can be solved by using Py::into_ref instead, which does not suffer from this issue. Note that the lifetime of the Python<'py> token is transferred to the returned reference.

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

    // This reference's lifetime is determined by `py`'s lifetime.
    // Because that originates from outside this function,
    // this return value is allowed.
    obj.into_ref(py)
}
source§

impl<T> Py<T>where T: PyClass,

source

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

Immutably borrows the value T.

This borrow lasts while the returned PyRef exists. Multiple immutable borrows can be taken out at the same time.

For frozen classes, the simpler get is available.

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

Examples
#[pyclass]
struct Foo {
    inner: u8,
}

Python::with_gil(|py| -> PyResult<()> {
    let foo: Py<Foo> = Py::new(py, Foo { inner: 73 })?;
    let inner: &u8 = &foo.borrow(py).inner;

    assert_eq!(*inner, 73);
    Ok(())
})?;
Panics

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

source

pub fn borrow_mut<'py>(&'py self, py: Python<'py>) -> PyRefMut<'py, T>where T: PyClass<Frozen = False>,

Mutably borrows the value T.

This borrow lasts while the returned PyRefMut exists.

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

Examples
#[pyclass]
struct Foo {
    inner: u8,
}

Python::with_gil(|py| -> PyResult<()> {
    let foo: Py<Foo> = Py::new(py, Foo { inner: 73 })?;
    foo.borrow_mut(py).inner = 35;

    assert_eq!(foo.borrow(py).inner, 35);
    Ok(())
})?;
Panics

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

source

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

Attempts to immutably borrow the value T, returning an error if the value is currently mutably borrowed.

The borrow lasts while the returned PyRef exists.

This is the non-panicking variant of borrow.

For frozen classes, the simpler get is available.

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

source

pub fn try_borrow_mut<'py>( &'py self, py: Python<'py> ) -> Result<PyRefMut<'py, T>, PyBorrowMutError>where T: PyClass<Frozen = False>,

Attempts to mutably borrow the value T, returning an error if the value is currently borrowed.

The borrow lasts while 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.

source

pub fn get(&self) -> &Twhere T: PyClass<Frozen = True> + Sync,

Provide an immutable borrow of the value T without acquiring the GIL.

This is available if the class is frozen and Sync.

Examples
use std::sync::atomic::{AtomicUsize, Ordering};

#[pyclass(frozen)]
struct FrozenCounter {
    value: AtomicUsize,
}

let cell  = Python::with_gil(|py| {
    let counter = FrozenCounter { value: AtomicUsize::new(0) };

    Py::new(py, counter).unwrap()
});

cell.get().value.fetch_add(1, Ordering::Relaxed);
source§

impl<T> Py<T>

source

pub fn is<U: AsPyPointer>(&self, o: &U) -> bool

Returns whether self and other point to the same object. To compare the equality of two objects (the == operator), use eq.

This is equivalent to the Python expression self is other.

source

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

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

source

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

Makes a clone of self.

This creates another pointer to the same object, increasing its reference count.

You should prefer using this method over Clone if you happen to be holding the GIL already.

Examples
use pyo3::prelude::*;
use pyo3::types::PyDict;

Python::with_gil(|py| {
    let first: Py<PyDict> = PyDict::new(py).into();
    let second = Py::clone_ref(&first, py);

    // Both point to the same object
    assert!(first.is(&second));
});
source

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

Returns whether the object is considered to be None.

This is equivalent to the Python expression self is None.

source

pub fn is_ellipsis(&self) -> bool

Returns whether the object is Ellipsis, e.g. ....

This is equivalent to the Python expression self is ....

source

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

Returns whether the object is considered to be true.

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

source

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

Extracts some type from the Python object.

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

source

pub fn getattr<N>(&self, py: Python<'_>, attr_name: N) -> PyResult<PyObject>where N: IntoPy<Py<PyString>>,

Retrieves an attribute value.

This is equivalent to the Python expression self.attr_name.

If calling this method becomes performance-critical, the intern! macro can be used to intern attr_name, thereby avoiding repeated temporary allocations of Python strings.

Example: intern!ing the attribute name
#[pyfunction]
fn version(sys: Py<PyModule>, py: Python<'_>) -> PyResult<PyObject> {
    sys.getattr(py, intern!(py, "version"))
}
source

pub fn setattr<N, V>( &self, py: Python<'_>, attr_name: N, value: V ) -> PyResult<()>where N: IntoPy<Py<PyString>>, V: IntoPy<Py<PyAny>>,

Sets an attribute value.

This is equivalent to the Python expression self.attr_name = value.

To avoid repeated temporary allocations of Python strings, the intern! macro can be used to intern attr_name.

Example: intern!ing the attribute name
#[pyfunction]
fn set_answer(ob: PyObject, py: Python<'_>) -> PyResult<()> {
    ob.setattr(py, intern!(py, "answer"), 42)
}
source

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

Calls the object.

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

source

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

Calls the object with only positional arguments.

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

source

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

Calls the object without arguments.

This is equivalent to the Python expression self().

source

pub fn call_method<N, A>( &self, py: Python<'_>, name: N, args: A, kwargs: Option<&PyDict> ) -> PyResult<PyObject>where N: IntoPy<Py<PyString>>, A: IntoPy<Py<PyTuple>>,

Calls a method on the object.

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

To avoid repeated temporary allocations of Python strings, the intern! macro can be used to intern name.

source

pub fn call_method1<N, A>( &self, py: Python<'_>, name: N, args: A ) -> PyResult<PyObject>where N: IntoPy<Py<PyString>>, A: IntoPy<Py<PyTuple>>,

Calls a method on the object with only positional arguments.

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

To avoid repeated temporary allocations of Python strings, the intern! macro can be used to intern name.

source

pub fn call_method0<N>(&self, py: Python<'_>, name: N) -> PyResult<PyObject>where N: IntoPy<Py<PyString>>,

Calls a method on the object with no arguments.

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

To avoid repeated temporary allocations of Python strings, the intern! macro can be used to intern name.

source

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

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.

source

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

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.

source

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

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.

source

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

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.

source

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

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.

source

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

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.

source§

impl Py<PyAny>

source

pub fn downcast<'p, T>( &'p self, py: Python<'p> ) -> Result<&T, PyDowncastError<'_>>where T: PyTryFrom<'p>,

Downcast this PyObject to a concrete Python type or pyclass.

Note that you can often avoid downcasting yourself by just specifying the desired type in function or method signatures. However, manual downcasting is sometimes necessary.

For extracting a Rust-only type, see Py::extract.

Example: Downcasting to a specific Python object
use pyo3::prelude::*;
use pyo3::types::{PyDict, PyList};

Python::with_gil(|py| {
    let any: PyObject = PyDict::new(py).into();

    assert!(any.downcast::<PyDict>(py).is_ok());
    assert!(any.downcast::<PyList>(py).is_err());
});
Example: Getting a reference to a pyclass

This is useful if you want to mutate a PyObject that might actually be a pyclass.

use pyo3::prelude::*;

#[pyclass]
struct Class {
    i: i32,
}

Python::with_gil(|py| {
    let class: PyObject = Py::new(py, Class { i: 0 }).unwrap().into_py(py);

    let class_cell: &PyCell<Class> = class.downcast(py)?;

    class_cell.borrow_mut().i += 1;

    // Alternatively you can get a `PyRefMut` directly
    let class_ref: PyRefMut<'_, Class> = class.extract(py)?;
    assert_eq!(class_ref.i, 1);
    Ok(())
})
source

pub unsafe fn downcast_unchecked<'p, T>(&'p self, py: Python<'p>) -> &Twhere T: PyTryFrom<'p>,

Casts the PyObject to a concrete Python object type without checking validity.

Safety

Callers must ensure that the type is valid or risk type confusion.

source

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

👎Deprecated since 0.18.0: use downcast() instead

Casts the PyObject to a concrete Python object type.

source§

impl Py<PyBytes>

source

pub fn as_bytes<'a>(&'a self, _py: Python<'_>) -> &'a [u8]

Gets the Python bytes as a byte slice. Because Python bytes are immutable, the result may be used for as long as the reference to self is held, including when the GIL is released.

source§

impl Py<PyIterator>

source

pub fn as_ref<'py>(&'py self, _py: Python<'py>) -> &'py PyIterator

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

source

pub fn into_ref(self, py: Python<'_>) -> &PyIterator

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.

source§

impl Py<PyMapping>

source

pub fn as_ref<'py>(&'py self, _py: Python<'py>) -> &'py PyMapping

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

source

pub fn into_ref(self, py: Python<'_>) -> &PyMapping

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.

source§

impl Py<PySequence>

source

pub fn as_ref<'py>(&'py self, _py: Python<'py>) -> &'py PySequence

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

let seq: Py<PySequence> = PyList::empty(py).as_sequence().into();
let seq: &PySequence = seq.as_ref(py);
assert_eq!(seq.len().unwrap(), 0);
source

pub fn into_ref(self, py: Python<'_>) -> &PySequence

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.

Trait Implementations§

source§

impl<T> AsPyPointer for Py<T>

source§

fn as_ptr(&self) -> *mut PyObject

Gets the underlying FFI pointer, returns a borrowed pointer.

source§

impl<T> Clone for Py<T>

If the GIL is held this increments self’s reference count. Otherwise this registers the Py<T> instance to have its reference count incremented the next time PyO3 acquires the GIL.

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T> Debug for Py<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de, T> Deserialize<'de> for Py<T>where T: PyClass<BaseType = PyAny> + Deserialize<'de>,

Available on crate feature serde only.
source§

fn deserialize<D>(deserializer: D) -> Result<Py<T>, D::Error>where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

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

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T> Drop for Py<T>

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

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

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

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

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

1.30.0 · source§

fn source(&self) -> Option<&(dyn Error + 'static)>

The lower-level source of this error, if any. Read more
1.0.0 · source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, demand: &mut Demand<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
source§

impl From<&CancelledError> for Py<CancelledError>

source§

fn from(other: &CancelledError) -> Self

Converts to this type from the input type.
source§

impl From<&IncompleteReadError> for Py<IncompleteReadError>

source§

fn from(other: &IncompleteReadError) -> Self

Converts to this type from the input type.
source§

impl From<&InvalidStateError> for Py<InvalidStateError>

source§

fn from(other: &InvalidStateError) -> Self

Converts to this type from the input type.
source§

impl From<&LimitOverrunError> for Py<LimitOverrunError>

source§

fn from(other: &LimitOverrunError) -> Self

Converts to this type from the input type.
source§

impl From<&PanicException> for Py<PanicException>

source§

fn from(other: &PanicException) -> Self

Converts to this type from the input type.
source§

impl From<&PyArithmeticError> for Py<PyArithmeticError>

source§

fn from(other: &PyArithmeticError) -> Self

Converts to this type from the input type.
source§

impl From<&PyAssertionError> for Py<PyAssertionError>

source§

fn from(other: &PyAssertionError) -> Self

Converts to this type from the input type.
source§

impl From<&PyAttributeError> for Py<PyAttributeError>

source§

fn from(other: &PyAttributeError) -> Self

Converts to this type from the input type.
source§

impl From<&PyBaseException> for Py<PyBaseException>

source§

fn from(other: &PyBaseException) -> Self

Converts to this type from the input type.
source§

impl From<&PyBlockingIOError> for Py<PyBlockingIOError>

source§

fn from(other: &PyBlockingIOError) -> Self

Converts to this type from the input type.
source§

impl From<&PyBool> for Py<PyBool>

source§

fn from(other: &PyBool) -> Self

Converts to this type from the input type.
source§

impl From<&PyBrokenPipeError> for Py<PyBrokenPipeError>

source§

fn from(other: &PyBrokenPipeError) -> Self

Converts to this type from the input type.
source§

impl From<&PyBufferError> for Py<PyBufferError>

source§

fn from(other: &PyBufferError) -> Self

Converts to this type from the input type.
source§

impl From<&PyByteArray> for Py<PyByteArray>

source§

fn from(other: &PyByteArray) -> Self

Converts to this type from the input type.
source§

impl From<&PyBytes> for Py<PyBytes>

source§

fn from(other: &PyBytes) -> Self

Converts to this type from the input type.
source§

impl From<&PyBytesWarning> for Py<PyBytesWarning>

source§

fn from(other: &PyBytesWarning) -> Self

Converts to this type from the input type.
source§

impl From<&PyCFunction> for Py<PyCFunction>

source§

fn from(other: &PyCFunction) -> Self

Converts to this type from the input type.
source§

impl From<&PyCapsule> for Py<PyCapsule>

source§

fn from(other: &PyCapsule) -> Self

Converts to this type from the input type.
source§

impl<T> From<&PyCell<T>> for Py<T>where T: PyClass,

source§

fn from(cell: &PyCell<T>) -> Self

Converts to this type from the input type.
source§

impl From<&PyChildProcessError> for Py<PyChildProcessError>

source§

fn from(other: &PyChildProcessError) -> Self

Converts to this type from the input type.
source§

impl From<&PyCode> for Py<PyCode>

Available on non-Py_LIMITED_API only.
source§

fn from(other: &PyCode) -> Self

Converts to this type from the input type.
source§

impl From<&PyComplex> for Py<PyComplex>

source§

fn from(other: &PyComplex) -> Self

Converts to this type from the input type.
source§

impl From<&PyConnectionAbortedError> for Py<PyConnectionAbortedError>

source§

fn from(other: &PyConnectionAbortedError) -> Self

Converts to this type from the input type.
source§

impl From<&PyConnectionError> for Py<PyConnectionError>

source§

fn from(other: &PyConnectionError) -> Self

Converts to this type from the input type.
source§

impl From<&PyConnectionRefusedError> for Py<PyConnectionRefusedError>

source§

fn from(other: &PyConnectionRefusedError) -> Self

Converts to this type from the input type.
source§

impl From<&PyConnectionResetError> for Py<PyConnectionResetError>

source§

fn from(other: &PyConnectionResetError) -> Self

Converts to this type from the input type.
source§

impl From<&PyDate> for Py<PyDate>

Available on non-Py_LIMITED_API only.
source§

fn from(other: &PyDate) -> Self

Converts to this type from the input type.
source§

impl From<&PyDateTime> for Py<PyDateTime>

Available on non-Py_LIMITED_API only.
source§

fn from(other: &PyDateTime) -> Self

Converts to this type from the input type.
source§

impl From<&PyDelta> for Py<PyDelta>

Available on non-Py_LIMITED_API only.
source§

fn from(other: &PyDelta) -> Self

Converts to this type from the input type.
source§

impl From<&PyDeprecationWarning> for Py<PyDeprecationWarning>

source§

fn from(other: &PyDeprecationWarning) -> Self

Converts to this type from the input type.
source§

impl From<&PyDict> for Py<PyDict>

source§

fn from(other: &PyDict) -> Self

Converts to this type from the input type.
source§

impl From<&PyDictItems> for Py<PyDictItems>

source§

fn from(other: &PyDictItems) -> Self

Converts to this type from the input type.
source§

impl From<&PyDictKeys> for Py<PyDictKeys>

source§

fn from(other: &PyDictKeys) -> Self

Converts to this type from the input type.
source§

impl From<&PyDictValues> for Py<PyDictValues>

source§

fn from(other: &PyDictValues) -> Self

Converts to this type from the input type.
source§

impl From<&PyEOFError> for Py<PyEOFError>

source§

fn from(other: &PyEOFError) -> Self

Converts to this type from the input type.
source§

impl From<&PyEncodingWarning> for Py<PyEncodingWarning>

source§

fn from(other: &PyEncodingWarning) -> Self

Converts to this type from the input type.
source§

impl From<&PyEnvironmentError> for Py<PyEnvironmentError>

source§

fn from(other: &PyEnvironmentError) -> Self

Converts to this type from the input type.
source§

impl From<&PyException> for Py<PyException>

source§

fn from(other: &PyException) -> Self

Converts to this type from the input type.
source§

impl From<&PyFileExistsError> for Py<PyFileExistsError>

source§

fn from(other: &PyFileExistsError) -> Self

Converts to this type from the input type.
source§

impl From<&PyFileNotFoundError> for Py<PyFileNotFoundError>

source§

fn from(other: &PyFileNotFoundError) -> Self

Converts to this type from the input type.
source§

impl From<&PyFloat> for Py<PyFloat>

source§

fn from(other: &PyFloat) -> Self

Converts to this type from the input type.
source§

impl From<&PyFloatingPointError> for Py<PyFloatingPointError>

source§

fn from(other: &PyFloatingPointError) -> Self

Converts to this type from the input type.
source§

impl From<&PyFrame> for Py<PyFrame>

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

fn from(other: &PyFrame) -> Self

Converts to this type from the input type.
source§

impl From<&PyFrozenSet> for Py<PyFrozenSet>

source§

fn from(other: &PyFrozenSet) -> Self

Converts to this type from the input type.
source§

impl From<&PyFunction> for Py<PyFunction>

source§

fn from(other: &PyFunction) -> Self

Converts to this type from the input type.
source§

impl From<&PyFutureWarning> for Py<PyFutureWarning>

source§

fn from(other: &PyFutureWarning) -> Self

Converts to this type from the input type.
source§

impl From<&PyGeneratorExit> for Py<PyGeneratorExit>

source§

fn from(other: &PyGeneratorExit) -> Self

Converts to this type from the input type.
source§

impl From<&PyIOError> for Py<PyIOError>

source§

fn from(other: &PyIOError) -> Self

Converts to this type from the input type.
source§

impl From<&PyImportError> for Py<PyImportError>

source§

fn from(other: &PyImportError) -> Self

Converts to this type from the input type.
source§

impl From<&PyImportWarning> for Py<PyImportWarning>

source§

fn from(other: &PyImportWarning) -> Self

Converts to this type from the input type.
source§

impl From<&PyIndexError> for Py<PyIndexError>

source§

fn from(other: &PyIndexError) -> Self

Converts to this type from the input type.
source§

impl From<&PyInterruptedError> for Py<PyInterruptedError>

source§

fn from(other: &PyInterruptedError) -> Self

Converts to this type from the input type.
source§

impl From<&PyIsADirectoryError> for Py<PyIsADirectoryError>

source§

fn from(other: &PyIsADirectoryError) -> Self

Converts to this type from the input type.
source§

impl From<&PyIterator> for Py<PyIterator>

source§

fn from(other: &PyIterator) -> Self

Converts to this type from the input type.
source§

impl From<&PyKeyError> for Py<PyKeyError>

source§

fn from(other: &PyKeyError) -> Self

Converts to this type from the input type.
source§

impl From<&PyKeyboardInterrupt> for Py<PyKeyboardInterrupt>

source§

fn from(other: &PyKeyboardInterrupt) -> Self

Converts to this type from the input type.
source§

impl From<&PyList> for Py<PyList>

source§

fn from(other: &PyList) -> Self

Converts to this type from the input type.
source§

impl From<&PyLong> for Py<PyLong>

source§

fn from(other: &PyLong) -> Self

Converts to this type from the input type.
source§

impl From<&PyLookupError> for Py<PyLookupError>

source§

fn from(other: &PyLookupError) -> Self

Converts to this type from the input type.
source§

impl From<&PyMapping> for Py<PyMapping>

source§

fn from(other: &PyMapping) -> Self

Converts to this type from the input type.
source§

impl From<&PyMemoryError> for Py<PyMemoryError>

source§

fn from(other: &PyMemoryError) -> Self

Converts to this type from the input type.
source§

impl From<&PyModule> for Py<PyModule>

source§

fn from(other: &PyModule) -> Self

Converts to this type from the input type.
source§

impl From<&PyModuleNotFoundError> for Py<PyModuleNotFoundError>

source§

fn from(other: &PyModuleNotFoundError) -> Self

Converts to this type from the input type.
source§

impl From<&PyNameError> for Py<PyNameError>

source§

fn from(other: &PyNameError) -> Self

Converts to this type from the input type.
source§

impl From<&PyNotADirectoryError> for Py<PyNotADirectoryError>

source§

fn from(other: &PyNotADirectoryError) -> Self

Converts to this type from the input type.
source§

impl From<&PyNotImplementedError> for Py<PyNotImplementedError>

source§

fn from(other: &PyNotImplementedError) -> Self

Converts to this type from the input type.
source§

impl From<&PyOSError> for Py<PyOSError>

source§

fn from(other: &PyOSError) -> Self

Converts to this type from the input type.
source§

impl From<&PyOverflowError> for Py<PyOverflowError>

source§

fn from(other: &PyOverflowError) -> Self

Converts to this type from the input type.
source§

impl From<&PyPendingDeprecationWarning> for Py<PyPendingDeprecationWarning>

source§

fn from(other: &PyPendingDeprecationWarning) -> Self

Converts to this type from the input type.
source§

impl From<&PyPermissionError> for Py<PyPermissionError>

source§

fn from(other: &PyPermissionError) -> Self

Converts to this type from the input type.
source§

impl From<&PyProcessLookupError> for Py<PyProcessLookupError>

source§

fn from(other: &PyProcessLookupError) -> Self

Converts to this type from the input type.
source§

impl From<&PyRecursionError> for Py<PyRecursionError>

source§

fn from(other: &PyRecursionError) -> Self

Converts to this type from the input type.
source§

impl From<&PyReferenceError> for Py<PyReferenceError>

source§

fn from(other: &PyReferenceError) -> Self

Converts to this type from the input type.
source§

impl From<&PyResourceWarning> for Py<PyResourceWarning>

source§

fn from(other: &PyResourceWarning) -> Self

Converts to this type from the input type.
source§

impl From<&PyRuntimeError> for Py<PyRuntimeError>

source§

fn from(other: &PyRuntimeError) -> Self

Converts to this type from the input type.
source§

impl From<&PyRuntimeWarning> for Py<PyRuntimeWarning>

source§

fn from(other: &PyRuntimeWarning) -> Self

Converts to this type from the input type.
source§

impl From<&PySequence> for Py<PySequence>

source§

fn from(other: &PySequence) -> Self

Converts to this type from the input type.
source§

impl From<&PySet> for Py<PySet>

source§

fn from(other: &PySet) -> Self

Converts to this type from the input type.
source§

impl From<&PySlice> for Py<PySlice>

source§

fn from(other: &PySlice) -> Self

Converts to this type from the input type.
source§

impl From<&PyStopAsyncIteration> for Py<PyStopAsyncIteration>

source§

fn from(other: &PyStopAsyncIteration) -> Self

Converts to this type from the input type.
source§

impl From<&PyStopIteration> for Py<PyStopIteration>

source§

fn from(other: &PyStopIteration) -> Self

Converts to this type from the input type.
source§

impl From<&PyString> for Py<PyString>

source§

fn from(other: &PyString) -> Self

Converts to this type from the input type.
source§

impl From<&PySuper> for Py<PySuper>

Available on non-PyPy only.
source§

fn from(other: &PySuper) -> Self

Converts to this type from the input type.
source§

impl From<&PySyntaxError> for Py<PySyntaxError>

source§

fn from(other: &PySyntaxError) -> Self

Converts to this type from the input type.
source§

impl From<&PySyntaxWarning> for Py<PySyntaxWarning>

source§

fn from(other: &PySyntaxWarning) -> Self

Converts to this type from the input type.
source§

impl From<&PySystemError> for Py<PySystemError>

source§

fn from(other: &PySystemError) -> Self

Converts to this type from the input type.
source§

impl From<&PySystemExit> for Py<PySystemExit>

source§

fn from(other: &PySystemExit) -> Self

Converts to this type from the input type.
source§

impl From<&PyTime> for Py<PyTime>

Available on non-Py_LIMITED_API only.
source§

fn from(other: &PyTime) -> Self

Converts to this type from the input type.
source§

impl From<&PyTimeoutError> for Py<PyTimeoutError>

source§

fn from(other: &PyTimeoutError) -> Self

Converts to this type from the input type.
source§

impl From<&PyTraceback> for Py<PyTraceback>

source§

fn from(other: &PyTraceback) -> Self

Converts to this type from the input type.
source§

impl From<&PyTuple> for Py<PyTuple>

source§

fn from(other: &PyTuple) -> Self

Converts to this type from the input type.
source§

impl From<&PyType> for Py<PyType>

source§

fn from(other: &PyType) -> Self

Converts to this type from the input type.
source§

impl From<&PyTypeError> for Py<PyTypeError>

source§

fn from(other: &PyTypeError) -> Self

Converts to this type from the input type.
source§

impl From<&PyTzInfo> for Py<PyTzInfo>

Available on non-Py_LIMITED_API only.
source§

fn from(other: &PyTzInfo) -> Self

Converts to this type from the input type.
source§

impl From<&PyUnboundLocalError> for Py<PyUnboundLocalError>

source§

fn from(other: &PyUnboundLocalError) -> Self

Converts to this type from the input type.
source§

impl From<&PyUnicodeDecodeError> for Py<PyUnicodeDecodeError>

source§

fn from(other: &PyUnicodeDecodeError) -> Self

Converts to this type from the input type.
source§

impl From<&PyUnicodeEncodeError> for Py<PyUnicodeEncodeError>

source§

fn from(other: &PyUnicodeEncodeError) -> Self

Converts to this type from the input type.
source§

impl From<&PyUnicodeError> for Py<PyUnicodeError>

source§

fn from(other: &PyUnicodeError) -> Self

Converts to this type from the input type.
source§

impl From<&PyUnicodeTranslateError> for Py<PyUnicodeTranslateError>

source§

fn from(other: &PyUnicodeTranslateError) -> Self

Converts to this type from the input type.
source§

impl From<&PyUnicodeWarning> for Py<PyUnicodeWarning>

source§

fn from(other: &PyUnicodeWarning) -> Self

Converts to this type from the input type.
source§

impl From<&PyUserWarning> for Py<PyUserWarning>

source§

fn from(other: &PyUserWarning) -> Self

Converts to this type from the input type.
source§

impl From<&PyValueError> for Py<PyValueError>

source§

fn from(other: &PyValueError) -> Self

Converts to this type from the input type.
source§

impl From<&PyWarning> for Py<PyWarning>

source§

fn from(other: &PyWarning) -> Self

Converts to this type from the input type.
source§

impl From<&PyZeroDivisionError> for Py<PyZeroDivisionError>

source§

fn from(other: &PyZeroDivisionError) -> Self

Converts to this type from the input type.
source§

impl From<&QueueEmpty> for Py<QueueEmpty>

source§

fn from(other: &QueueEmpty) -> Self

Converts to this type from the input type.
source§

impl From<&QueueFull> for Py<QueueFull>

source§

fn from(other: &QueueFull) -> Self

Converts to this type from the input type.
source§

impl From<&TimeoutError> for Py<TimeoutError>

source§

fn from(other: &TimeoutError) -> Self

Converts to this type from the input type.
source§

impl From<&gaierror> for Py<gaierror>

source§

fn from(other: &gaierror) -> Self

Converts to this type from the input type.
source§

impl From<&herror> for Py<herror>

source§

fn from(other: &herror) -> Self

Converts to this type from the input type.
source§

impl From<&timeout> for Py<timeout>

source§

fn from(other: &timeout) -> Self

Converts to this type from the input type.
source§

impl<T: PyClass> From<Py<T>> for PyClassInitializer<T>

source§

fn from(value: Py<T>) -> PyClassInitializer<T>

Converts to this type from the input type.
source§

impl<T> From<Py<T>> for PyObjectwhere T: AsRef<PyAny>,

source§

fn from(other: Py<T>) -> Self

Converts to this type from the input type.
source§

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

source§

fn from(pyref: PyRef<'a, T>) -> Self

Converts to this type from the input type.
source§

impl<'a, T> From<PyRefMut<'a, T>> for Py<T>where T: PyClass<Frozen = False>,

source§

fn from(pyref: PyRefMut<'a, T>) -> Self

Converts to this type from the input type.
source§

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

source§

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

Extracts Self from the source PyObject.

source§

impl IntoPy<Py<CancelledError>> for &CancelledError

source§

fn into_py(self, py: Python<'_>) -> Py<CancelledError>

Performs the conversion.
source§

impl IntoPy<Py<IncompleteReadError>> for &IncompleteReadError

source§

fn into_py(self, py: Python<'_>) -> Py<IncompleteReadError>

Performs the conversion.
source§

impl IntoPy<Py<InvalidStateError>> for &InvalidStateError

source§

fn into_py(self, py: Python<'_>) -> Py<InvalidStateError>

Performs the conversion.
source§

impl IntoPy<Py<LimitOverrunError>> for &LimitOverrunError

source§

fn into_py(self, py: Python<'_>) -> Py<LimitOverrunError>

Performs the conversion.
source§

impl IntoPy<Py<PanicException>> for &PanicException

source§

fn into_py(self, py: Python<'_>) -> Py<PanicException>

Performs the conversion.
source§

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

source§

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

Performs the conversion.
source§

impl<'a> IntoPy<Py<PyAny>> for &'a OsString

source§

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

Performs the conversion.
source§

impl<'a> IntoPy<Py<PyAny>> for &'a Path

source§

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

Performs the conversion.
source§

impl<'a> IntoPy<Py<PyAny>> for &'a PathBuf

source§

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

Performs the conversion.
source§

impl<'a> IntoPy<Py<PyAny>> for &'a PyErr

source§

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

Performs the conversion.
source§

impl<'a> IntoPy<Py<PyAny>> for &'a String

source§

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

Performs the conversion.
source§

impl<'a> IntoPy<Py<PyAny>> for &'a str

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for &OsStr

source§

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

Performs the conversion.
source§

impl<T> IntoPy<Py<PyAny>> for &Twhere T: AsPyPointer,

source§

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

Performs the conversion.
source§

impl<T, const N: usize> IntoPy<Py<PyAny>> for [T; N]where T: IntoPy<PyObject>,

Available on min_const_generics only.
source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for ()

source§

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

Performs the conversion.
source§

impl<T0: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (T0,)

source§

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

Performs the conversion.
source§

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (T0, T1)

source§

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

Performs the conversion.
source§

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (T0, T1, T2)

source§

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

Performs the conversion.
source§

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (T0, T1, T2, T3)

source§

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

Performs the conversion.
source§

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (T0, T1, T2, T3, T4)

source§

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

Performs the conversion.
source§

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (T0, T1, T2, T3, T4, T5)

source§

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

Performs the conversion.
source§

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>, T6: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (T0, T1, T2, T3, T4, T5, T6)

source§

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

Performs the conversion.
source§

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>, T6: IntoPy<PyObject>, T7: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (T0, T1, T2, T3, T4, T5, T6, T7)

source§

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

Performs the conversion.
source§

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>, T6: IntoPy<PyObject>, T7: IntoPy<PyObject>, T8: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (T0, T1, T2, T3, T4, T5, T6, T7, T8)

source§

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

Performs the conversion.
source§

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>, T6: IntoPy<PyObject>, T7: IntoPy<PyObject>, T8: IntoPy<PyObject>, T9: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)

source§

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

Performs the conversion.
source§

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>, T6: IntoPy<PyObject>, T7: IntoPy<PyObject>, T8: IntoPy<PyObject>, T9: IntoPy<PyObject>, T10: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

source§

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

Performs the conversion.
source§

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>, T6: IntoPy<PyObject>, T7: IntoPy<PyObject>, T8: IntoPy<PyObject>, T9: IntoPy<PyObject>, T10: IntoPy<PyObject>, T11: IntoPy<PyObject>> IntoPy<Py<PyAny>> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)

source§

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

Performs the conversion.
source§

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

source§

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

Performs the conversion.
source§

impl<K> IntoPy<Py<PyAny>> for BTreeSet<K>where K: IntoPy<PyObject> + Ord,

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for BigInt

Available on crate feature num-bigint only.
source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for BigUint

Available on crate feature num-bigint only.
source§

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

Performs the conversion.
source§

impl<T: Copy + IntoPy<PyObject>> IntoPy<Py<PyAny>> for Cell<T>

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for Complex<f32>

Available on crate feature num-complex only.
source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for Complex<f64>

Available on crate feature num-complex only.
source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for Cow<'_, [u8]>

source§

fn into_py(self, py: Python<'_>) -> Py<PyAny>

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for Cow<'_, OsStr>

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for Cow<'_, str>

source§

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

Performs the conversion.
source§

impl<'a> IntoPy<Py<PyAny>> for Cow<'a, Path>

source§

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

Performs the conversion.
source§

impl<Tz: TimeZone> IntoPy<Py<PyAny>> for DateTime<Tz>

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

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for Decimal

Available on crate feature rust_decimal only.
source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for Duration

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

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for FixedOffset

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

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

Performs the conversion.
source§

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

source§

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

Performs the conversion.
source§

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

Available on crate feature hashbrown only.
source§

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

Performs the conversion.
source§

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

source§

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

Performs the conversion.
source§

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

Available on crate feature hashbrown only.
source§

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

Performs the conversion.
source§

impl<K, V, H> IntoPy<Py<PyAny>> for IndexMap<K, V, H>where K: Hash + Eq + IntoPy<PyObject>, V: IntoPy<PyObject>, H: BuildHasher,

Available on crate feature indexmap only.
source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for IpAddr

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for NaiveDate

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

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for NaiveDateTime

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

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for NaiveTime

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

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for NonZeroI128

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for NonZeroI16

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for NonZeroI32

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for NonZeroI64

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for NonZeroI8

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for NonZeroIsize

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for NonZeroU128

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for NonZeroU16

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for NonZeroU32

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for NonZeroU64

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for NonZeroU8

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for NonZeroUsize

source§

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

Performs the conversion.
source§

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

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for OsString

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for PathBuf

source§

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

Performs the conversion.
source§

impl<T> IntoPy<Py<PyAny>> for Py<T>

source§

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

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

source§

impl IntoPy<Py<PyAny>> for PyErr

source§

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

Performs the conversion.
source§

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

source§

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

Performs the conversion.
source§

impl<T: PyClass<Frozen = False>> IntoPy<Py<PyAny>> for PyRefMut<'_, T>

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for String

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for Utc

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

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

Performs the conversion.
source§

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

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for bool

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for char

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for f32

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for f64

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for i128

Available on non-Py_LIMITED_API only.
source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for i16

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for i32

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for i64

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for i8

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for isize

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for u128

Available on non-Py_LIMITED_API only.
source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for u16

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for u32

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for u64

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for u8

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyAny>> for usize

source§

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

Performs the conversion.
source§

impl IntoPy<Py<PyArithmeticError>> for &PyArithmeticError

source§

fn into_py(self, py: Python<'_>) -> Py<PyArithmeticError>

Performs the conversion.
source§

impl IntoPy<Py<PyAssertionError>> for &PyAssertionError

source§

fn into_py(self, py: Python<'_>) -> Py<PyAssertionError>

Performs the conversion.
source§

impl IntoPy<Py<PyAttributeError>> for &PyAttributeError

source§

fn into_py(self, py: Python<'_>) -> Py<PyAttributeError>

Performs the conversion.
source§

impl IntoPy<Py<PyBaseException>> for &PyBaseException

source§

fn into_py(self, py: Python<'_>) -> Py<PyBaseException>

Performs the conversion.
source§

impl IntoPy<Py<PyBlockingIOError>> for &PyBlockingIOError

source§

fn into_py(self, py: Python<'_>) -> Py<PyBlockingIOError>

Performs the conversion.
source§

impl IntoPy<Py<PyBool>> for &PyBool

source§

fn into_py(self, py: Python<'_>) -> Py<PyBool>

Performs the conversion.
source§

impl IntoPy<Py<PyBrokenPipeError>> for &PyBrokenPipeError

source§

fn into_py(self, py: Python<'_>) -> Py<PyBrokenPipeError>

Performs the conversion.
source§

impl IntoPy<Py<PyBufferError>> for &PyBufferError

source§

fn into_py(self, py: Python<'_>) -> Py<PyBufferError>

Performs the conversion.
source§

impl IntoPy<Py<PyByteArray>> for &PyByteArray

source§

fn into_py(self, py: Python<'_>) -> Py<PyByteArray>

Performs the conversion.
source§

impl IntoPy<Py<PyBytes>> for &PyBytes

source§

fn into_py(self, py: Python<'_>) -> Py<PyBytes>

Performs the conversion.
source§

impl IntoPy<Py<PyBytesWarning>> for &PyBytesWarning

source§

fn into_py(self, py: Python<'_>) -> Py<PyBytesWarning>

Performs the conversion.
source§

impl IntoPy<Py<PyCFunction>> for &PyCFunction

source§

fn into_py(self, py: Python<'_>) -> Py<PyCFunction>

Performs the conversion.
source§

impl IntoPy<Py<PyCapsule>> for &PyCapsule

source§

fn into_py(self, py: Python<'_>) -> Py<PyCapsule>

Performs the conversion.
source§

impl IntoPy<Py<PyChildProcessError>> for &PyChildProcessError

source§

fn into_py(self, py: Python<'_>) -> Py<PyChildProcessError>

Performs the conversion.
source§

impl IntoPy<Py<PyCode>> for &PyCode

Available on non-Py_LIMITED_API only.
source§

fn into_py(self, py: Python<'_>) -> Py<PyCode>

Performs the conversion.
source§

impl IntoPy<Py<PyComplex>> for &PyComplex

source§

fn into_py(self, py: Python<'_>) -> Py<PyComplex>

Performs the conversion.
source§

impl IntoPy<Py<PyConnectionAbortedError>> for &PyConnectionAbortedError

source§

fn into_py(self, py: Python<'_>) -> Py<PyConnectionAbortedError>

Performs the conversion.
source§

impl IntoPy<Py<PyConnectionError>> for &PyConnectionError

source§

fn into_py(self, py: Python<'_>) -> Py<PyConnectionError>

Performs the conversion.
source§

impl IntoPy<Py<PyConnectionRefusedError>> for &PyConnectionRefusedError

source§

fn into_py(self, py: Python<'_>) -> Py<PyConnectionRefusedError>

Performs the conversion.
source§

impl IntoPy<Py<PyConnectionResetError>> for &PyConnectionResetError

source§

fn into_py(self, py: Python<'_>) -> Py<PyConnectionResetError>

Performs the conversion.
source§

impl IntoPy<Py<PyDate>> for &PyDate

Available on non-Py_LIMITED_API only.
source§

fn into_py(self, py: Python<'_>) -> Py<PyDate>

Performs the conversion.
source§

impl IntoPy<Py<PyDateTime>> for &PyDateTime

Available on non-Py_LIMITED_API only.
source§

fn into_py(self, py: Python<'_>) -> Py<PyDateTime>

Performs the conversion.
source§

impl IntoPy<Py<PyDelta>> for &PyDelta

Available on non-Py_LIMITED_API only.
source§

fn into_py(self, py: Python<'_>) -> Py<PyDelta>

Performs the conversion.
source§

impl IntoPy<Py<PyDeprecationWarning>> for &PyDeprecationWarning

source§

fn into_py(self, py: Python<'_>) -> Py<PyDeprecationWarning>

Performs the conversion.
source§

impl IntoPy<Py<PyDict>> for &PyDict

source§

fn into_py(self, py: Python<'_>) -> Py<PyDict>

Performs the conversion.
source§

impl IntoPy<Py<PyDictItems>> for &PyDictItems

source§

fn into_py(self, py: Python<'_>) -> Py<PyDictItems>

Performs the conversion.
source§

impl IntoPy<Py<PyDictKeys>> for &PyDictKeys

source§

fn into_py(self, py: Python<'_>) -> Py<PyDictKeys>

Performs the conversion.
source§

impl IntoPy<Py<PyDictValues>> for &PyDictValues

source§

fn into_py(self, py: Python<'_>) -> Py<PyDictValues>

Performs the conversion.
source§

impl IntoPy<Py<PyEOFError>> for &PyEOFError

source§

fn into_py(self, py: Python<'_>) -> Py<PyEOFError>

Performs the conversion.
source§

impl IntoPy<Py<PyEncodingWarning>> for &PyEncodingWarning

source§

fn into_py(self, py: Python<'_>) -> Py<PyEncodingWarning>

Performs the conversion.
source§

impl IntoPy<Py<PyEnvironmentError>> for &PyEnvironmentError

source§

fn into_py(self, py: Python<'_>) -> Py<PyEnvironmentError>

Performs the conversion.
source§

impl IntoPy<Py<PyException>> for &PyException

source§

fn into_py(self, py: Python<'_>) -> Py<PyException>

Performs the conversion.
source§

impl IntoPy<Py<PyFileExistsError>> for &PyFileExistsError

source§

fn into_py(self, py: Python<'_>) -> Py<PyFileExistsError>

Performs the conversion.
source§

impl IntoPy<Py<PyFileNotFoundError>> for &PyFileNotFoundError

source§

fn into_py(self, py: Python<'_>) -> Py<PyFileNotFoundError>

Performs the conversion.
source§

impl IntoPy<Py<PyFloat>> for &PyFloat

source§

fn into_py(self, py: Python<'_>) -> Py<PyFloat>

Performs the conversion.
source§

impl IntoPy<Py<PyFloatingPointError>> for &PyFloatingPointError

source§

fn into_py(self, py: Python<'_>) -> Py<PyFloatingPointError>

Performs the conversion.
source§

impl IntoPy<Py<PyFrame>> for &PyFrame

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

fn into_py(self, py: Python<'_>) -> Py<PyFrame>

Performs the conversion.
source§

impl IntoPy<Py<PyFrozenSet>> for &PyFrozenSet

source§

fn into_py(self, py: Python<'_>) -> Py<PyFrozenSet>

Performs the conversion.
source§

impl IntoPy<Py<PyFunction>> for &PyFunction

source§

fn into_py(self, py: Python<'_>) -> Py<PyFunction>

Performs the conversion.
source§

impl IntoPy<Py<PyFutureWarning>> for &PyFutureWarning

source§

fn into_py(self, py: Python<'_>) -> Py<PyFutureWarning>

Performs the conversion.
source§

impl IntoPy<Py<PyGeneratorExit>> for &PyGeneratorExit

source§

fn into_py(self, py: Python<'_>) -> Py<PyGeneratorExit>

Performs the conversion.
source§

impl IntoPy<Py<PyIOError>> for &PyIOError

source§

fn into_py(self, py: Python<'_>) -> Py<PyIOError>

Performs the conversion.
source§

impl IntoPy<Py<PyImportError>> for &PyImportError

source§

fn into_py(self, py: Python<'_>) -> Py<PyImportError>

Performs the conversion.
source§

impl IntoPy<Py<PyImportWarning>> for &PyImportWarning

source§

fn into_py(self, py: Python<'_>) -> Py<PyImportWarning>

Performs the conversion.
source§

impl IntoPy<Py<PyIndexError>> for &PyIndexError

source§

fn into_py(self, py: Python<'_>) -> Py<PyIndexError>

Performs the conversion.
source§

impl IntoPy<Py<PyInterruptedError>> for &PyInterruptedError

source§

fn into_py(self, py: Python<'_>) -> Py<PyInterruptedError>

Performs the conversion.
source§

impl IntoPy<Py<PyIsADirectoryError>> for &PyIsADirectoryError

source§

fn into_py(self, py: Python<'_>) -> Py<PyIsADirectoryError>

Performs the conversion.
source§

impl IntoPy<Py<PyIterator>> for &PyIterator

source§

fn into_py(self, py: Python<'_>) -> Py<PyIterator>

Performs the conversion.
source§

impl IntoPy<Py<PyKeyError>> for &PyKeyError

source§

fn into_py(self, py: Python<'_>) -> Py<PyKeyError>

Performs the conversion.
source§

impl IntoPy<Py<PyKeyboardInterrupt>> for &PyKeyboardInterrupt

source§

fn into_py(self, py: Python<'_>) -> Py<PyKeyboardInterrupt>

Performs the conversion.
source§

impl IntoPy<Py<PyList>> for &PyList

source§

fn into_py(self, py: Python<'_>) -> Py<PyList>

Performs the conversion.
source§

impl IntoPy<Py<PyLong>> for &PyLong

source§

fn into_py(self, py: Python<'_>) -> Py<PyLong>

Performs the conversion.
source§

impl IntoPy<Py<PyLookupError>> for &PyLookupError

source§

fn into_py(self, py: Python<'_>) -> Py<PyLookupError>

Performs the conversion.
source§

impl IntoPy<Py<PyMapping>> for &PyMapping

source§

fn into_py(self, py: Python<'_>) -> Py<PyMapping>

Performs the conversion.
source§

impl IntoPy<Py<PyMemoryError>> for &PyMemoryError

source§

fn into_py(self, py: Python<'_>) -> Py<PyMemoryError>

Performs the conversion.
source§

impl IntoPy<Py<PyModule>> for &PyModule

source§

fn into_py(self, py: Python<'_>) -> Py<PyModule>

Performs the conversion.
source§

impl IntoPy<Py<PyModuleNotFoundError>> for &PyModuleNotFoundError

source§

fn into_py(self, py: Python<'_>) -> Py<PyModuleNotFoundError>

Performs the conversion.
source§

impl IntoPy<Py<PyNameError>> for &PyNameError

source§

fn into_py(self, py: Python<'_>) -> Py<PyNameError>

Performs the conversion.
source§

impl IntoPy<Py<PyNotADirectoryError>> for &PyNotADirectoryError

source§

fn into_py(self, py: Python<'_>) -> Py<PyNotADirectoryError>

Performs the conversion.
source§

impl IntoPy<Py<PyNotImplementedError>> for &PyNotImplementedError

source§

fn into_py(self, py: Python<'_>) -> Py<PyNotImplementedError>

Performs the conversion.
source§

impl IntoPy<Py<PyOSError>> for &PyOSError

source§

fn into_py(self, py: Python<'_>) -> Py<PyOSError>

Performs the conversion.
source§

impl IntoPy<Py<PyOverflowError>> for &PyOverflowError

source§

fn into_py(self, py: Python<'_>) -> Py<PyOverflowError>

Performs the conversion.
source§

impl IntoPy<Py<PyPendingDeprecationWarning>> for &PyPendingDeprecationWarning

source§

fn into_py(self, py: Python<'_>) -> Py<PyPendingDeprecationWarning>

Performs the conversion.
source§

impl IntoPy<Py<PyPermissionError>> for &PyPermissionError

source§

fn into_py(self, py: Python<'_>) -> Py<PyPermissionError>

Performs the conversion.
source§

impl IntoPy<Py<PyProcessLookupError>> for &PyProcessLookupError

source§

fn into_py(self, py: Python<'_>) -> Py<PyProcessLookupError>

Performs the conversion.
source§

impl IntoPy<Py<PyRecursionError>> for &PyRecursionError

source§

fn into_py(self, py: Python<'_>) -> Py<PyRecursionError>

Performs the conversion.
source§

impl IntoPy<Py<PyReferenceError>> for &PyReferenceError

source§

fn into_py(self, py: Python<'_>) -> Py<PyReferenceError>

Performs the conversion.
source§

impl IntoPy<Py<PyResourceWarning>> for &PyResourceWarning

source§

fn into_py(self, py: Python<'_>) -> Py<PyResourceWarning>

Performs the conversion.
source§

impl IntoPy<Py<PyRuntimeError>> for &PyRuntimeError

source§

fn into_py(self, py: Python<'_>) -> Py<PyRuntimeError>

Performs the conversion.
source§

impl IntoPy<Py<PyRuntimeWarning>> for &PyRuntimeWarning

source§

fn into_py(self, py: Python<'_>) -> Py<PyRuntimeWarning>

Performs the conversion.
source§

impl IntoPy<Py<PySequence>> for &PySequence

source§

fn into_py(self, py: Python<'_>) -> Py<PySequence>

Performs the conversion.
source§

impl IntoPy<Py<PySet>> for &PySet

source§

fn into_py(self, py: Python<'_>) -> Py<PySet>

Performs the conversion.
source§

impl IntoPy<Py<PySlice>> for &PySlice

source§

fn into_py(self, py: Python<'_>) -> Py<PySlice>

Performs the conversion.
source§

impl IntoPy<Py<PyStopAsyncIteration>> for &PyStopAsyncIteration

source§

fn into_py(self, py: Python<'_>) -> Py<PyStopAsyncIteration>

Performs the conversion.
source§

impl IntoPy<Py<PyStopIteration>> for &PyStopIteration

source§

fn into_py(self, py: Python<'_>) -> Py<PyStopIteration>

Performs the conversion.
source§

impl<'a> IntoPy<Py<PyString>> for &'a str

source§

fn into_py(self, py: Python<'_>) -> Py<PyString>

Performs the conversion.
source§

impl IntoPy<Py<PyString>> for &PyString

source§

fn into_py(self, py: Python<'_>) -> Py<PyString>

Performs the conversion.
source§

impl IntoPy<Py<PySuper>> for &PySuper

Available on non-PyPy only.
source§

fn into_py(self, py: Python<'_>) -> Py<PySuper>

Performs the conversion.
source§

impl IntoPy<Py<PySyntaxError>> for &PySyntaxError

source§

fn into_py(self, py: Python<'_>) -> Py<PySyntaxError>

Performs the conversion.
source§

impl IntoPy<Py<PySyntaxWarning>> for &PySyntaxWarning

source§

fn into_py(self, py: Python<'_>) -> Py<PySyntaxWarning>

Performs the conversion.
source§

impl IntoPy<Py<PySystemError>> for &PySystemError

source§

fn into_py(self, py: Python<'_>) -> Py<PySystemError>

Performs the conversion.
source§

impl IntoPy<Py<PySystemExit>> for &PySystemExit

source§

fn into_py(self, py: Python<'_>) -> Py<PySystemExit>

Performs the conversion.
source§

impl IntoPy<Py<PyTime>> for &PyTime

Available on non-Py_LIMITED_API only.
source§

fn into_py(self, py: Python<'_>) -> Py<PyTime>

Performs the conversion.
source§

impl IntoPy<Py<PyTimeoutError>> for &PyTimeoutError

source§

fn into_py(self, py: Python<'_>) -> Py<PyTimeoutError>

Performs the conversion.
source§

impl IntoPy<Py<PyTraceback>> for &PyTraceback

source§

fn into_py(self, py: Python<'_>) -> Py<PyTraceback>

Performs the conversion.
source§

impl IntoPy<Py<PyTuple>> for &PyTuple

source§

fn into_py(self, py: Python<'_>) -> Py<PyTuple>

Performs the conversion.
source§

impl IntoPy<Py<PyTuple>> for ()

Converts () to an empty Python tuple.

source§

fn into_py(self, py: Python<'_>) -> Py<PyTuple>

Performs the conversion.
source§

impl<T0: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (T0,)

source§

fn into_py(self, py: Python<'_>) -> Py<PyTuple>

Performs the conversion.
source§

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (T0, T1)

source§

fn into_py(self, py: Python<'_>) -> Py<PyTuple>

Performs the conversion.
source§

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (T0, T1, T2)

source§

fn into_py(self, py: Python<'_>) -> Py<PyTuple>

Performs the conversion.
source§

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (T0, T1, T2, T3)

source§

fn into_py(self, py: Python<'_>) -> Py<PyTuple>

Performs the conversion.
source§

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (T0, T1, T2, T3, T4)

source§

fn into_py(self, py: Python<'_>) -> Py<PyTuple>

Performs the conversion.
source§

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (T0, T1, T2, T3, T4, T5)

source§

fn into_py(self, py: Python<'_>) -> Py<PyTuple>

Performs the conversion.
source§

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>, T6: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (T0, T1, T2, T3, T4, T5, T6)

source§

fn into_py(self, py: Python<'_>) -> Py<PyTuple>

Performs the conversion.
source§

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>, T6: IntoPy<PyObject>, T7: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (T0, T1, T2, T3, T4, T5, T6, T7)

source§

fn into_py(self, py: Python<'_>) -> Py<PyTuple>

Performs the conversion.
source§

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>, T6: IntoPy<PyObject>, T7: IntoPy<PyObject>, T8: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (T0, T1, T2, T3, T4, T5, T6, T7, T8)

source§

fn into_py(self, py: Python<'_>) -> Py<PyTuple>

Performs the conversion.
source§

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>, T6: IntoPy<PyObject>, T7: IntoPy<PyObject>, T8: IntoPy<PyObject>, T9: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)

source§

fn into_py(self, py: Python<'_>) -> Py<PyTuple>

Performs the conversion.
source§

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>, T6: IntoPy<PyObject>, T7: IntoPy<PyObject>, T8: IntoPy<PyObject>, T9: IntoPy<PyObject>, T10: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

source§

fn into_py(self, py: Python<'_>) -> Py<PyTuple>

Performs the conversion.
source§

impl<T0: IntoPy<PyObject>, T1: IntoPy<PyObject>, T2: IntoPy<PyObject>, T3: IntoPy<PyObject>, T4: IntoPy<PyObject>, T5: IntoPy<PyObject>, T6: IntoPy<PyObject>, T7: IntoPy<PyObject>, T8: IntoPy<PyObject>, T9: IntoPy<PyObject>, T10: IntoPy<PyObject>, T11: IntoPy<PyObject>> IntoPy<Py<PyTuple>> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)

source§

fn into_py(self, py: Python<'_>) -> Py<PyTuple>

Performs the conversion.
source§

impl IntoPy<Py<PyType>> for &PyType

source§

fn into_py(self, py: Python<'_>) -> Py<PyType>

Performs the conversion.
source§

impl IntoPy<Py<PyTypeError>> for &PyTypeError

source§

fn into_py(self, py: Python<'_>) -> Py<PyTypeError>

Performs the conversion.
source§

impl IntoPy<Py<PyTzInfo>> for &PyTzInfo

Available on non-Py_LIMITED_API only.
source§

fn into_py(self, py: Python<'_>) -> Py<PyTzInfo>

Performs the conversion.
source§

impl IntoPy<Py<PyUnboundLocalError>> for &PyUnboundLocalError

source§

fn into_py(self, py: Python<'_>) -> Py<PyUnboundLocalError>

Performs the conversion.
source§

impl IntoPy<Py<PyUnicodeDecodeError>> for &PyUnicodeDecodeError

source§

fn into_py(self, py: Python<'_>) -> Py<PyUnicodeDecodeError>

Performs the conversion.
source§

impl IntoPy<Py<PyUnicodeEncodeError>> for &PyUnicodeEncodeError

source§

fn into_py(self, py: Python<'_>) -> Py<PyUnicodeEncodeError>

Performs the conversion.
source§

impl IntoPy<Py<PyUnicodeError>> for &PyUnicodeError

source§

fn into_py(self, py: Python<'_>) -> Py<PyUnicodeError>

Performs the conversion.
source§

impl IntoPy<Py<PyUnicodeTranslateError>> for &PyUnicodeTranslateError

source§

fn into_py(self, py: Python<'_>) -> Py<PyUnicodeTranslateError>

Performs the conversion.
source§

impl IntoPy<Py<PyUnicodeWarning>> for &PyUnicodeWarning

source§

fn into_py(self, py: Python<'_>) -> Py<PyUnicodeWarning>

Performs the conversion.
source§

impl IntoPy<Py<PyUserWarning>> for &PyUserWarning

source§

fn into_py(self, py: Python<'_>) -> Py<PyUserWarning>

Performs the conversion.
source§

impl IntoPy<Py<PyValueError>> for &PyValueError

source§

fn into_py(self, py: Python<'_>) -> Py<PyValueError>

Performs the conversion.
source§

impl IntoPy<Py<PyWarning>> for &PyWarning

source§

fn into_py(self, py: Python<'_>) -> Py<PyWarning>

Performs the conversion.
source§

impl IntoPy<Py<PyZeroDivisionError>> for &PyZeroDivisionError

source§

fn into_py(self, py: Python<'_>) -> Py<PyZeroDivisionError>

Performs the conversion.
source§

impl IntoPy<Py<QueueEmpty>> for &QueueEmpty

source§

fn into_py(self, py: Python<'_>) -> Py<QueueEmpty>

Performs the conversion.
source§

impl IntoPy<Py<QueueFull>> for &QueueFull

source§

fn into_py(self, py: Python<'_>) -> Py<QueueFull>

Performs the conversion.
source§

impl IntoPy<Py<TimeoutError>> for &TimeoutError

source§

fn into_py(self, py: Python<'_>) -> Py<TimeoutError>

Performs the conversion.
source§

impl IntoPy<Py<gaierror>> for &gaierror

source§

fn into_py(self, py: Python<'_>) -> Py<gaierror>

Performs the conversion.
source§

impl IntoPy<Py<herror>> for &herror

source§

fn into_py(self, py: Python<'_>) -> Py<herror>

Performs the conversion.
source§

impl IntoPy<Py<timeout>> for &timeout

source§

fn into_py(self, py: Python<'_>) -> Py<timeout>

Performs the conversion.
source§

impl<T> IntoPyPointer for Py<T>

source§

fn into_ptr(self) -> *mut PyObject

Gets the underlying FFI pointer, returns a owned pointer.

source§

impl<T> Serialize for Py<T>where T: Serialize + PyClass,

Available on crate feature serde only.
source§

fn serialize<S>( &self, serializer: S ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<T> ToPyObject for Py<T>

source§

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

Converts Py instance -> PyObject.

source§

impl<T> Send for Py<T>

source§

impl<T> Sync for Py<T>

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§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<E> Provider for Ewhere E: Error + ?Sized,

source§

fn provide<'a>(&'a self, demand: &mut Demand<'a>)

🔬This is a nightly-only experimental API. (provide_any)
Data providers should implement this method to provide all values they are able to provide by using demand. Read more
source§

impl<T> PyErrArguments for Twhere T: IntoPy<Py<PyAny>> + Send + Sync,

source§

fn arguments(self, py: Python<'_>) -> Py<PyAny>

Arguments for exception
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,

source§

impl<T> Ungil for Twhere T: Send,