use std::fmt::Debug;
pub trait Collection: PartialEq + Debug + Clone {
type Type;
fn is_contained_in(&self, container: &Self) -> bool;
fn contains(&self, content: &Self::Type) -> bool;
fn overlaps(&self, other: &Self) -> bool;
fn is_left(&self, other: &Self) -> bool;
fn is_over_or_left(&self, other: &Self) -> bool;
fn is_over_or_right(&self, other: &Self) -> bool;
fn is_right(&self, other: &Self) -> bool;
fn is_adjacent(&self, other: &Self) -> bool;
}
macro_rules! impl_collection {
($type:ident, $subtype_type:ty) => {
type Type = $subtype_type;
paste::paste! {
fn is_contained_in(&self, container: &Self) -> bool {
unsafe { meos_sys::[<contained _ $type _ $type>](self.inner(), container.inner()) }
}
fn overlaps(&self, other: &Self) -> bool {
unsafe { meos_sys::[<overlaps _ $type _ $type>](self.inner(), other.inner()) }
}
fn is_left(&self, other: &Self) -> bool {
unsafe { meos_sys::[<left _ $type _ $type>](self.inner(), other.inner()) }
}
fn is_over_or_left(&self, other: &Self) -> bool {
unsafe { meos_sys::[<overleft _ $type _ $type>](self.inner(), other.inner()) }
}
fn is_over_or_right(&self, other: &Self) -> bool {
unsafe { meos_sys::[<overright _ $type _ $type>](self.inner(), other.inner()) }
}
fn is_right(&self, other: &Self) -> bool {
unsafe { meos_sys::[<right _ $type _ $type>](self.inner(), other.inner()) }
}
fn is_adjacent(&self, other: &Self) -> bool {
unsafe { meos_sys::[<adjacent _ $type _ $type>](self.inner(), other.inner()) }
}
}
};
}
pub(crate) use impl_collection;