pyo3/impl_/pyclass/
probes.rsuse std::marker::PhantomData;
use crate::{conversion::IntoPyObject, Py};
#[allow(deprecated)]
use crate::{IntoPy, ToPyObject};
pub trait Probe {
const VALUE: bool = false;
}
macro_rules! probe {
($name:ident) => {
pub struct $name<T>(PhantomData<T>);
impl<T> Probe for $name<T> {}
};
}
probe!(IsPyT);
impl<T> IsPyT<Py<T>> {
pub const VALUE: bool = true;
}
probe!(IsToPyObject);
#[allow(deprecated)]
impl<T: ToPyObject> IsToPyObject<T> {
pub const VALUE: bool = true;
}
probe!(IsIntoPy);
#[allow(deprecated)]
impl<T: IntoPy<crate::PyObject>> IsIntoPy<T> {
pub const VALUE: bool = true;
}
probe!(IsIntoPyObjectRef);
#[allow(clippy::extra_unused_lifetimes)]
impl<'a, 'py, T: 'a> IsIntoPyObjectRef<T>
where
&'a T: IntoPyObject<'py>,
{
pub const VALUE: bool = true;
}
probe!(IsIntoPyObject);
impl<'py, T> IsIntoPyObject<T>
where
T: IntoPyObject<'py>,
{
pub const VALUE: bool = true;
}
probe!(IsSync);
impl<T: Sync> IsSync<T> {
pub const VALUE: bool = true;
}