use core::iter::FusedIterator;
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash, Default)]
pub struct Nil;
impl Nil {
pub const LEN: usize = 0;
pub const fn new() -> Self {
Self
}
pub const fn len(&self) -> usize {
Self::LEN
}
pub const fn is_empty(&self) -> bool {
true
}
}
impl AsRef<Nil> for Nil {
fn as_ref(&self) -> &Nil {
self
}
}
impl AsMut<Nil> for Nil {
fn as_mut(&mut self) -> &mut Nil {
self
}
}
impl Iterator for Nil {
type Item = Nil;
fn next(&mut self) -> Option<Self::Item> {
None
}
fn size_hint(&self) -> (usize, Option<usize>) {
let len = Nil::len(self);
(len, Some(len))
}
}
impl ExactSizeIterator for Nil {
fn len(&self) -> usize {
Nil::len(self)
}
}
impl FusedIterator for Nil {}