use crate::GeoFloat;
use geo_types::Line;
use std::rc::Rc;
use std::sync::Arc;
pub trait Cross {
type Scalar: GeoFloat;
fn line(&self) -> Line<Self::Scalar>;
}
impl<T: GeoFloat> Cross for Line<T> {
type Scalar = T;
fn line(&self) -> Line<Self::Scalar> {
*self
}
}
impl<C: Cross> Cross for &C {
type Scalar = C::Scalar;
fn line(&self) -> Line<Self::Scalar> {
C::line(*self)
}
}
macro_rules! blanket_impl_smart_pointer {
($ty:ty) => {
impl<T: Cross> Cross for $ty {
type Scalar = T::Scalar;
fn line(&self) -> Line<Self::Scalar> {
T::line(self)
}
}
};
}
blanket_impl_smart_pointer!(Box<T>);
blanket_impl_smart_pointer!(Rc<T>);
blanket_impl_smart_pointer!(Arc<T>);