use std::io;
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum ReadStatus {
Done,
NotDone,
}
impl ReadStatus {
pub fn check<R>(reader: &mut R) -> io::Result<Self>
where
R: io::BufRead,
{
reader.fill_buf().map(|b| match b.is_empty() {
true => Self::Done,
false => Self::NotDone,
})
}
pub fn is_done(&self) -> bool {
matches!(self, Self::Done)
}
pub fn is_not_done(&self) -> bool {
matches!(self, Self::NotDone)
}
}