22struct IteratorOutput {
33 edges : Vec < tskit:: EdgeTableRow > ,
44 nodes : Vec < tskit:: NodeTableRow > ,
5+ sites : Vec < tskit:: SiteTableRow > ,
6+ mutations : Vec < tskit:: MutationTableRow > ,
7+ migrations : Vec < tskit:: MigrationTableRow > ,
8+ populations : Vec < tskit:: PopulationTableRow > ,
59}
610
711impl IteratorOutput {
812 fn new_from_tables ( tables : & tskit:: TableCollection ) -> Self {
913 let edges = tables. edges ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
1014 let nodes = tables. nodes ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
11- Self { edges, nodes }
15+ let sites = tables. sites ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
16+ let mutations = tables. mutations ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
17+ let populations = tables. populations ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
18+ let migrations = tables. migrations ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
19+ Self {
20+ edges,
21+ nodes,
22+ sites,
23+ mutations,
24+ populations,
25+ migrations,
26+ }
1227 }
1328
1429 fn new_from_treeseq ( treeseq : & tskit:: TreeSequence ) -> Self {
1530 let edges = treeseq. tables ( ) . edges ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
1631 let nodes = treeseq. tables ( ) . nodes ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
17- Self { edges, nodes }
32+ let sites = treeseq. tables ( ) . sites ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
33+ let mutations = treeseq. tables ( ) . mutations ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
34+ let populations = treeseq. tables ( ) . populations ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
35+ let migrations = treeseq. tables ( ) . migrations ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
36+ Self {
37+ edges,
38+ nodes,
39+ sites,
40+ mutations,
41+ populations,
42+ migrations,
43+ }
1844 }
1945
2046 fn new_from_table_access < T > ( access : & T ) -> Self
@@ -23,7 +49,18 @@ impl IteratorOutput {
2349 {
2450 let edges = access. edges ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
2551 let nodes = access. nodes ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
26- Self { edges, nodes }
52+ let sites = access. sites ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
53+ let mutations = access. mutations ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
54+ let populations = access. populations ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
55+ let migrations = access. migrations ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
56+ Self {
57+ edges,
58+ nodes,
59+ sites,
60+ mutations,
61+ populations,
62+ migrations,
63+ }
2764 }
2865
2966 fn new_from_table_iteration < T > ( iterator : & T ) -> Self
@@ -32,13 +69,35 @@ impl IteratorOutput {
3269 {
3370 let edges = iterator. edges ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
3471 let nodes = iterator. nodes ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
35- Self { edges, nodes }
72+ let sites = iterator. sites ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
73+ let mutations = iterator. mutations ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
74+ let populations = iterator. populations ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
75+ let migrations = iterator. migrations ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
76+ Self {
77+ edges,
78+ nodes,
79+ sites,
80+ mutations,
81+ populations,
82+ migrations,
83+ }
3684 }
3785
3886 fn new_from_dyn ( dynamic : & dyn tskit:: ObjectSafeTableIteration ) -> Self {
3987 let edges = dynamic. edges ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
4088 let nodes = dynamic. nodes ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
41- Self { edges, nodes }
89+ let sites = dynamic. sites ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
90+ let mutations = dynamic. mutations ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
91+ let populations = dynamic. populations ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
92+ let migrations = dynamic. migrations ( ) . iter ( ) . collect :: < Vec < _ > > ( ) ;
93+ Self {
94+ edges,
95+ nodes,
96+ sites,
97+ mutations,
98+ populations,
99+ migrations,
100+ }
42101 }
43102}
44103
@@ -89,7 +148,9 @@ fn test_traits_with_table_collection() {
89148#[ test]
90149fn test_traits_with_tree_sequence ( ) {
91150 let mut tables = make_tables ( ) ;
92- tables. full_sort ( tskit:: TableSortOptions :: default ( ) ) . unwrap ( ) ;
151+ tables
152+ . full_sort ( tskit:: TableSortOptions :: default ( ) )
153+ . unwrap ( ) ;
93154 tables. build_index ( ) . unwrap ( ) ;
94155 let treeseq = tskit:: TreeSequence :: try_from ( tables) . unwrap ( ) ;
95156 validate_output_from_treeseq ( treeseq)
0 commit comments