use std::{io, str};
pub trait ReferenceBases {
fn is_empty(&self) -> bool;
fn len(&self) -> usize;
fn iter(&self) -> Box<dyn Iterator<Item = io::Result<u8>> + '_>;
}
impl ReferenceBases for &str {
fn is_empty(&self) -> bool {
str::is_empty(self)
}
fn len(&self) -> usize {
str::len(self)
}
fn iter(&self) -> Box<dyn Iterator<Item = io::Result<u8>> + '_> {
Box::new(self.as_bytes().iter().copied().map(Ok))
}
}
impl ReferenceBases for Box<dyn ReferenceBases + '_> {
fn is_empty(&self) -> bool {
(**self).is_empty()
}
fn len(&self) -> usize {
(**self).len()
}
fn iter(&self) -> Box<dyn Iterator<Item = io::Result<u8>> + '_> {
(**self).iter()
}
}