use core::cell::Cell;
pub struct ElementIterator<T> {
element: Cell<Option<T>>
}
impl<T> ElementIterator<T> {
pub fn new(element: T) -> Self {
ElementIterator {
element: Cell::new(Some(element))
}
}
}
impl<T> Iterator for ElementIterator<T> {
type Item = T;
fn next(&mut self) -> Option<Self::Item> {
self.element.take()
}
}