Trait cpython::PythonObject [] [src]

pub trait PythonObject: ToPyObject + Sized + 'static {
    fn as_object(&self) -> &PyObject;
    fn into_object(self) -> PyObject;
    unsafe fn unchecked_downcast_from(PyObject) -> Self;
    unsafe fn unchecked_downcast_borrow_from(&PyObject) -> &Self;
}

Trait implemented by all Python object types.

Required Methods

fn as_object(&self) -> &PyObject

Casts the Python object to PyObject.

fn into_object(self) -> PyObject

Casts the Python object to PyObject.

unsafe fn unchecked_downcast_from(PyObject) -> Self

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

unsafe fn unchecked_downcast_borrow_from(&PyObject) -> &Self

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

Implementors