fix prefixing
parent
dfc10cbb53
commit
baca166fda
@ -1,24 +1,24 @@
|
||||
use crate::adapters::AdaptInfo;
|
||||
|
||||
// TODO: using iterator trait possible?? should basically be Iterator<AdaptInfo>
|
||||
pub trait ReadIter {
|
||||
pub trait AdaptedFilesIter {
|
||||
// next takes a 'a-lived reference and returns an AdaptInfo that lives as long as the reference
|
||||
fn next<'a>(&'a mut self) -> Option<AdaptInfo<'a>>;
|
||||
}
|
||||
|
||||
/// A single AdaptInfo
|
||||
pub struct SingleReadIter<'a> {
|
||||
pub struct SingleAdaptedFileAsIter<'a> {
|
||||
ai: Option<AdaptInfo<'a>>,
|
||||
}
|
||||
impl SingleReadIter<'_> {
|
||||
pub fn new<'a>(ai: AdaptInfo<'a>) -> SingleReadIter<'a> {
|
||||
SingleReadIter { ai: Some(ai) }
|
||||
impl SingleAdaptedFileAsIter<'_> {
|
||||
pub fn new<'a>(ai: AdaptInfo<'a>) -> SingleAdaptedFileAsIter<'a> {
|
||||
SingleAdaptedFileAsIter { ai: Some(ai) }
|
||||
}
|
||||
}
|
||||
impl ReadIter for SingleReadIter<'_> {
|
||||
impl AdaptedFilesIter for SingleAdaptedFileAsIter<'_> {
|
||||
fn next<'a>(&'a mut self) -> Option<AdaptInfo<'a>> {
|
||||
self.ai.take()
|
||||
}
|
||||
}
|
||||
|
||||
pub type ReadIterBox<'a> = Box<dyn ReadIter + 'a>;
|
||||
pub type AdaptedFilesIterBox<'a> = Box<dyn AdaptedFilesIter + 'a>;
|
Loading…
Reference in New Issue