pub trait PyTypeCheck {
const NAME: &'static str;
const PYTHON_TYPE: &'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§
Sourceconst PYTHON_TYPE: &'static str
Available on crate feature experimental-inspect
only.
const PYTHON_TYPE: &'static str
experimental-inspect
only.Provides the full python type of the allowed values.
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.