#![doc = include_str!("../readme.md")]
pub trait HasScreenCursor {
fn screen_cursor(&self) -> Option<(u16, u16)>;
}
#[inline(always)]
pub fn screen_cursor<const N: usize>(list: [&dyn HasScreenCursor; N]) -> Option<(u16, u16)> {
for v in list {
if let Some(v) = v.screen_cursor() {
return Some(v);
}
}
None
}
#[macro_export]
macro_rules! impl_screen_cursor {
($($n:ident),* for $ty:ty) => {
impl $crate::HasScreenCursor for $ty {
fn screen_cursor(&self) -> Option<(u16, u16)> {
use $crate::screen_cursor;
screen_cursor([
$(&self.$n),*
])
}
}
};
}