pub trait PyTypeCheck {
const NAME: &'static str;
// Required method
fn type_check(object: &Bound<'_, PyAny>) -> bool;
}
Expand description
Implemented by types which can be used as a concrete Python type inside Py<T>
smart pointers.
Required Associated Constants§
Required Methods§
Sourcefn type_check(object: &Bound<'_, PyAny>) -> bool
fn type_check(object: &Bound<'_, PyAny>) -> bool
Checks if object
is an instance of Self
, which may include a subtype.
This should be equivalent to the Python expression isinstance(object, Self)
.
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 PyTypeCheck for PyCode
Available on Py_LIMITED_API
or PyPy
only.
impl PyTypeCheck for PyCode
Available on
Py_LIMITED_API
or PyPy
only.Source§impl PyTypeCheck for PyDate
Available on Py_LIMITED_API
only.
impl PyTypeCheck for PyDate
Available on
Py_LIMITED_API
only.Source§impl PyTypeCheck for PyDateTime
Available on Py_LIMITED_API
only.
impl PyTypeCheck for PyDateTime
Available on
Py_LIMITED_API
only.Source§impl PyTypeCheck for PyDelta
Available on Py_LIMITED_API
only.
impl PyTypeCheck for PyDelta
Available on
Py_LIMITED_API
only.Source§impl PyTypeCheck for PyIterator
impl PyTypeCheck for PyIterator
Source§impl PyTypeCheck for PySequence
impl PyTypeCheck for PySequence
Source§impl PyTypeCheck for PyTime
Available on Py_LIMITED_API
only.
impl PyTypeCheck for PyTime
Available on
Py_LIMITED_API
only.Source§impl PyTypeCheck for PyTzInfo
Available on Py_LIMITED_API
only.
impl PyTypeCheck for PyTzInfo
Available on
Py_LIMITED_API
only.Source§impl PyTypeCheck for PyWeakrefProxy
impl PyTypeCheck for PyWeakrefProxy
Source§impl PyTypeCheck for PyWeakrefReference
Available on PyPy
or GraalPy
or Py_LIMITED_API
only.
impl PyTypeCheck for PyWeakrefReference
Available on
PyPy
or GraalPy
or Py_LIMITED_API
only.