#[derive(Debug, Clone, Copy, Default, Hash, PartialEq, Eq, PartialOrd, Ord)]
pub struct HorizontalLine<T> {
pub main: Option<T>,
pub intersection: Option<T>,
pub left: Option<T>,
pub right: Option<T>,
}
impl<T> HorizontalLine<T> {
pub const fn new(
main: Option<T>,
intersection: Option<T>,
left: Option<T>,
right: Option<T>,
) -> Self {
Self {
main,
intersection,
left,
right,
}
}
pub const fn full(main: T, intersection: T, left: T, right: T) -> Self {
Self::new(Some(main), Some(intersection), Some(left), Some(right))
}
pub const fn filled(val: T) -> Self
where
T: Copy,
{
Self {
main: Some(val),
intersection: Some(val),
left: Some(val),
right: Some(val),
}
}
pub const fn empty() -> Self {
Self::new(None, None, None, None)
}
pub const fn is_empty(&self) -> bool {
self.main.is_none()
&& self.intersection.is_none()
&& self.left.is_none()
&& self.right.is_none()
}
}