Trait AsObject

Source
pub trait AsObject
where Self: Borrow<PyObject>,
{ // Provided methods fn as_object(&self) -> &PyObject { ... } fn get_id(&self) -> usize { ... } fn is<T>(&self, other: &T) -> bool where T: AsObject { ... } fn class(&self) -> &Py<PyType> { ... } fn get_class_attr( &self, attr_name: &'static PyStrInterned, ) -> Option<PyObjectRef> { ... } fn fast_isinstance(&self, cls: &Py<PyType>) -> bool { ... } }

Provided Methods§

Source

fn as_object(&self) -> &PyObject

Source

fn get_id(&self) -> usize

Source

fn is<T>(&self, other: &T) -> bool
where T: AsObject,

Source

fn class(&self) -> &Py<PyType>

Source

fn get_class_attr( &self, attr_name: &'static PyStrInterned, ) -> Option<PyObjectRef>

Source

fn fast_isinstance(&self, cls: &Py<PyType>) -> bool

Determines if obj actually an instance of cls, this doesn’t call instancecheck, so only use this if cls is known to have not overridden the base instancecheck magic method.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> AsObject for T
where T: Borrow<PyObject>,

Morty Proxy This is a proxified and sanitized view of the page, visit original site.