tskit 0.16.0

rust interface to tskit
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
pub struct SiteRefIterator<'ts> {
    pub sites: &'ts [super::bindings::tsk_site_t],
    pub current: usize,
}

impl<'ts> Iterator for SiteRefIterator<'ts> {
    type Item = super::SiteRef<'ts>;
    fn next(&mut self) -> Option<Self::Item> {
        let n = self.sites.get(self.current).map(|s| super::new_site_ref(s));
        self.current += 1;
        n
    }

    fn nth(&mut self, n: usize) -> Option<Self::Item> {
        self.current = n;
        self.sites.get(self.current).map(|s| super::new_site_ref(s))
    }
}