Trait cpython::PythonObject
source · [−]pub trait PythonObject: ToPyObject + Send + Sized + 'static {
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
sourcefn into_object(self) -> PyObject
fn into_object(self) -> PyObject
Casts the Python object to PyObject.
sourceunsafe fn unchecked_downcast_from(obj: PyObject) -> Self
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.
sourceunsafe fn unchecked_downcast_borrow_from(obj: &PyObject) -> &Self
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.