use crate::BitSlice;
use core::iter::Iterator;
#[derive(Clone, Debug)]
pub struct Iter<'a> {
slice: &'a BitSlice,
}
impl<'a> Iter<'a> {
pub fn new(slice: &'a BitSlice) -> Self {
Self { slice }
}
}
impl<'a> Iterator for Iter<'a> {
type Item = bool;
fn next(&mut self) -> Option<bool> {
match self.slice.split_first() {
Some((bit, rest)) => {
self.slice = rest;
Some(bit)
}
None => None,
}
}
}