Trait cpython::PythonObjectWithCheckedDowncast

source ·
pub trait PythonObjectWithCheckedDowncast: PythonObject {
    // Required methods
    fn downcast_from(
        py: Python<'_>,
        obj: PyObject
    ) -> Result<Self, PythonObjectDowncastError<'_>>;
    fn downcast_borrow_from<'a, 'p>(
        py: Python<'p>,
        obj: &'a PyObject
    ) -> Result<&'a Self, PythonObjectDowncastError<'p>>;
}
Expand description

Trait implemented by Python object types that allow a checked downcast.

Required Methods§

source

fn downcast_from( py: Python<'_>, obj: PyObject ) -> Result<Self, PythonObjectDowncastError<'_>>

Cast from PyObject to a concrete Python object type.

source

fn downcast_borrow_from<'a, 'p>( py: Python<'p>, obj: &'a PyObject ) -> Result<&'a Self, PythonObjectDowncastError<'p>>

Cast from PyObject to a concrete Python object type.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl PythonObjectWithCheckedDowncast for AssertionError

source§

impl PythonObjectWithCheckedDowncast for AttributeError

source§

impl PythonObjectWithCheckedDowncast for BaseException

source§

impl PythonObjectWithCheckedDowncast for BlockingIOError

source§

impl PythonObjectWithCheckedDowncast for BrokenPipeError

source§

impl PythonObjectWithCheckedDowncast for BufferError

source§

impl PythonObjectWithCheckedDowncast for ChildProcessError

source§

impl PythonObjectWithCheckedDowncast for ConnectionAbortedError

source§

impl PythonObjectWithCheckedDowncast for ConnectionError

source§

impl PythonObjectWithCheckedDowncast for ConnectionRefusedError

source§

impl PythonObjectWithCheckedDowncast for ConnectionResetError

source§

impl PythonObjectWithCheckedDowncast for EOFError

source§

impl PythonObjectWithCheckedDowncast for EnvironmentError

source§

impl PythonObjectWithCheckedDowncast for Exception

source§

impl PythonObjectWithCheckedDowncast for FileExistsError

source§

impl PythonObjectWithCheckedDowncast for FileNotFoundError

source§

impl PythonObjectWithCheckedDowncast for FloatingPointError

source§

impl PythonObjectWithCheckedDowncast for IOError

source§

impl PythonObjectWithCheckedDowncast for ImportError

source§

impl PythonObjectWithCheckedDowncast for IndexError

source§

impl PythonObjectWithCheckedDowncast for InterruptedError

source§

impl PythonObjectWithCheckedDowncast for IsADirectoryError

source§

impl PythonObjectWithCheckedDowncast for KeyError

source§

impl PythonObjectWithCheckedDowncast for KeyboardInterrupt

source§

impl PythonObjectWithCheckedDowncast for LookupError

source§

impl PythonObjectWithCheckedDowncast for MemoryError

source§

impl PythonObjectWithCheckedDowncast for NameError

source§

impl PythonObjectWithCheckedDowncast for NotADirectoryError

source§

impl PythonObjectWithCheckedDowncast for NotImplementedError

source§

impl PythonObjectWithCheckedDowncast for OSError

source§

impl PythonObjectWithCheckedDowncast for OverflowError

source§

impl PythonObjectWithCheckedDowncast for PermissionError

source§

impl PythonObjectWithCheckedDowncast for ProcessLookupError

source§

impl PythonObjectWithCheckedDowncast for ReferenceError

source§

impl PythonObjectWithCheckedDowncast for RuntimeError

source§

impl PythonObjectWithCheckedDowncast for SyntaxError

source§

impl PythonObjectWithCheckedDowncast for SystemError

source§

impl PythonObjectWithCheckedDowncast for SystemExit

source§

impl PythonObjectWithCheckedDowncast for TimeoutError

source§

impl PythonObjectWithCheckedDowncast for TypeError

source§

impl PythonObjectWithCheckedDowncast for UnicodeDecodeError

source§

impl PythonObjectWithCheckedDowncast for UnicodeEncodeError

source§

impl PythonObjectWithCheckedDowncast for UnicodeTranslateError

source§

impl PythonObjectWithCheckedDowncast for ValueError

source§

impl PythonObjectWithCheckedDowncast for ZeroDivisionError

source§

impl PythonObjectWithCheckedDowncast for PyBool

source§

impl PythonObjectWithCheckedDowncast for PyBytes

source§

impl PythonObjectWithCheckedDowncast for PyCapsule

source§

impl PythonObjectWithCheckedDowncast for PyDict

source§

impl PythonObjectWithCheckedDowncast for PyFloat

source§

impl PythonObjectWithCheckedDowncast for PyLong

source§

impl PythonObjectWithCheckedDowncast for PyList

source§

impl PythonObjectWithCheckedDowncast for PyModule

source§

impl PythonObjectWithCheckedDowncast for PyObject

source§

impl PythonObjectWithCheckedDowncast for PySequence

source§

impl PythonObjectWithCheckedDowncast for PySet

source§

impl PythonObjectWithCheckedDowncast for PyTuple

source§

impl PythonObjectWithCheckedDowncast for PyType

source§

impl PythonObjectWithCheckedDowncast for PyString