pub trait CUGIterator: Iterator<Item = BusRecord> { }Expand description
A marker trait for iterators over CB/UMI/gene_EC iterators
to create an iterator compatible with this framework,
just implement the usual iterator trait (giving the next() function)
and also tag the iterator with CUGIterator: impl CUGIterator for Dummy {}
§Example
struct Dummy{
f: u32
}
use bustools_core::io::{BusRecord, CUGIterator};
impl Iterator for Dummy {
type Item=BusRecord;
fn next(&mut self) -> Option<Self::Item> {
Some(BusRecord{CB: 0,UMI: 0, EC: 0, COUNT: self.f, FLAG:0})
}
}
impl CUGIterator for Dummy {}
let mut x = Dummy{f:1};
let s = x.next();
println!("{s:?}")pretty much a type alias for Iterator<Item=BusRecord>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
impl CUGIterator for IntoIter<BusRecord>
actually, also make general iterators of BusRecord amenable