Trait cpython::PythonObject

source ·
pub trait PythonObject: ToPyObject + Send + Sized + 'static {
    // Required methods
    fn as_object(&self) -> &PyObject;
    fn into_object(self) -> PyObject;
    unsafe fn unchecked_downcast_from(obj: PyObject) -> Self;
    unsafe fn unchecked_downcast_borrow_from(obj: &PyObject) -> &Self;
}
Expand description

Trait implemented by all Python object types.

Required Methods§

source

fn as_object(&self) -> &PyObject

Casts the Python object to PyObject.

source

fn into_object(self) -> PyObject

Casts the Python object to PyObject.

source

unsafe fn unchecked_downcast_from(obj: PyObject) -> Self

Unchecked downcast from PyObject to Self. Undefined behavior if the input object does not have the expected type.

source

unsafe fn unchecked_downcast_borrow_from(obj: &PyObject) -> &Self

Unchecked downcast from PyObject to Self. Undefined behavior if the input object does not have the expected type.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl PythonObject for AssertionError

source§

impl PythonObject for AttributeError

source§

impl PythonObject for BaseException

source§

impl PythonObject for BlockingIOError

source§

impl PythonObject for BrokenPipeError

source§

impl PythonObject for BufferError

source§

impl PythonObject for ChildProcessError

source§

impl PythonObject for ConnectionAbortedError

source§

impl PythonObject for ConnectionError

source§

impl PythonObject for ConnectionRefusedError

source§

impl PythonObject for ConnectionResetError

source§

impl PythonObject for EOFError

source§

impl PythonObject for EnvironmentError

source§

impl PythonObject for Exception

source§

impl PythonObject for FileExistsError

source§

impl PythonObject for FileNotFoundError

source§

impl PythonObject for FloatingPointError

source§

impl PythonObject for IOError

source§

impl PythonObject for ImportError

source§

impl PythonObject for IndexError

source§

impl PythonObject for InterruptedError

source§

impl PythonObject for IsADirectoryError

source§

impl PythonObject for KeyError

source§

impl PythonObject for KeyboardInterrupt

source§

impl PythonObject for LookupError

source§

impl PythonObject for MemoryError

source§

impl PythonObject for NameError

source§

impl PythonObject for NotADirectoryError

source§

impl PythonObject for NotImplementedError

source§

impl PythonObject for OSError

source§

impl PythonObject for OverflowError

source§

impl PythonObject for PermissionError

source§

impl PythonObject for ProcessLookupError

source§

impl PythonObject for ReferenceError

source§

impl PythonObject for RuntimeError

source§

impl PythonObject for SyntaxError

source§

impl PythonObject for SystemError

source§

impl PythonObject for SystemExit

source§

impl PythonObject for TimeoutError

source§

impl PythonObject for TypeError

source§

impl PythonObject for UnicodeDecodeError

source§

impl PythonObject for UnicodeEncodeError

source§

impl PythonObject for UnicodeTranslateError

source§

impl PythonObject for ValueError

source§

impl PythonObject for ZeroDivisionError

source§

impl PythonObject for PyBool

source§

impl PythonObject for PyBytes

source§

impl PythonObject for PyCapsule

source§

impl PythonObject for PyDict

source§

impl PythonObject for PyFloat

source§

impl PythonObject for PyLong

source§

impl PythonObject for PyList

source§

impl PythonObject for PyModule

source§

impl PythonObject for PyObject

source§

impl PythonObject for PySequence

source§

impl PythonObject for PySet

source§

impl PythonObject for PyTuple

source§

impl PythonObject for PyType

source§

impl PythonObject for PyString