cleanup (WIP)
parent
f401a96386
commit
002c62f57c
@ -1,24 +1,8 @@
|
||||
use crate::adapters::AdaptInfo;
|
||||
use tokio_stream::Stream;
|
||||
|
||||
// TODO: using iterator trait possible?? should basically be Iterator<AdaptInfo>
|
||||
pub trait AdaptedFilesIter: Send {
|
||||
// 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>;
|
||||
}
|
||||
use crate::adapters::AdaptInfo;
|
||||
|
||||
/// A single AdaptInfo
|
||||
pub struct SingleAdaptedFileAsIter {
|
||||
ai: Option<AdaptInfo>,
|
||||
}
|
||||
impl SingleAdaptedFileAsIter {
|
||||
pub fn new<'a>(ai: AdaptInfo) -> SingleAdaptedFileAsIter {
|
||||
SingleAdaptedFileAsIter { ai: Some(ai) }
|
||||
}
|
||||
}
|
||||
impl AdaptedFilesIter for SingleAdaptedFileAsIter {
|
||||
fn next<'a>(&'a mut self) -> Option<AdaptInfo> {
|
||||
self.ai.take()
|
||||
}
|
||||
}
|
||||
pub trait AdaptedFilesIter: Stream<Item = AdaptInfo> + Send + Unpin {}
|
||||
impl<T> AdaptedFilesIter for T where T: Stream<Item = AdaptInfo> + Send + Unpin {}
|
||||
|
||||
pub type AdaptedFilesIterBox = Box<dyn AdaptedFilesIter>;
|
||||
|
Loading…
Reference in New Issue