}

tskit-rust provides rust bindings to the tskit C library.

let treeseq = tskit::TreeSequence::load(
  &treefile
).unwrap();
let mut tree_iterator = 
  treeseq.tree_iterator(
    tskit::TreeFlags::default()
  ).unwrap();
while let Some(tree) = 
  tree_iterator.next() {
    ...
  }