use crate::{Orientation, Pos, Size};
pub(crate) mod border;
pub(crate) mod corner;
pub(crate) mod end;
pub(crate) mod fill;
pub(crate) mod literal;
pub(crate) mod segment;
pub(crate) mod symbol;
pub(crate) fn run(from: Pos, len: u16, orientation: Orientation) -> impl Iterator<Item = Pos> {
(0..len).filter_map(move |i| match orientation {
Orientation::Horizontal => from.x.checked_add_unsigned(i).map(|x| Pos { x, y: from.y }),
Orientation::Vertical => from.y.checked_add_unsigned(i).map(|y| Pos { x: from.x, y }),
})
}
pub(crate) fn rect(at: Pos, size: Size) -> impl Iterator<Item = Pos> {
(0..size.height).flat_map(move |dy| {
(0..size.width).filter_map(move |dx| {
at.y.checked_add_unsigned(dy)
.and_then(|y| at.x.checked_add_unsigned(dx).map(|x| Pos { x, y }))
})
})
}