pub trait AsObject{
// 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§
fn as_object(&self) -> &PyObject
fn get_id(&self) -> usize
fn is<T>(&self, other: &T) -> boolwhere
T: AsObject,
fn class(&self) -> &Py<PyType>
fn get_class_attr( &self, attr_name: &'static PyStrInterned, ) -> Option<PyObjectRef>
Sourcefn fast_isinstance(&self, cls: &Py<PyType>) -> bool
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.