std_prelude!();
use crate::{Pet, PetRef, Pred};
pub trait PredExt<T: ?Sized>: Pred<T> {
fn pet(t: T) -> Option<Pet<T, Self>>
where
T: Sized;
unsafe fn pet_unchecked(t: T) -> Pet<T, Self>
where
T: Sized;
fn petref<'a>(t: &'a T) -> Option<PetRef<'a, T, Self>>;
unsafe fn petref_unchecked<'a>(t: &'a T) -> PetRef<'a, T, Self>;
}
impl<T: ?Sized, P: Pred<T>> PredExt<T> for P {
fn pet(t: T) -> Option<Pet<T, P>>
where
T: Sized,
{
Pet::new(t)
}
unsafe fn pet_unchecked(t: T) -> Pet<T, P>
where
T: Sized,
{
Pet::new_unchecked(t)
}
fn petref<'a>(t: &'a T) -> Option<PetRef<'a, T, P>> {
PetRef::new(t)
}
unsafe fn petref_unchecked<'a>(t: &'a T) -> PetRef<'a, T, P> {
PetRef::new_unchecked(t)
}
}