@@ -39,6 +39,9 @@ pub fn simple_time_reverser(x: Time) -> Box<dyn Fn(Time) -> f64> {
3939/// If the input ``tables`` are not sorted, pass ``false`` for
4040/// `build_indexes`.
4141///
42+ /// This function will not be part of the long-term API.
43+ /// Rather, it is the minimum currently needed to get stuff done.
44+ ///
4245/// # Returns
4346///
4447/// A [``tskit_rust::TableCollection``].
@@ -51,7 +54,7 @@ pub fn simple_time_reverser(x: Time) -> Box<dyn Fn(Time) -> f64> {
5154/// tables.add_node(1, 0).unwrap(); // Add a child node at time 1
5255/// tables.add_edge(0, 100, 0, 1).unwrap(); // Add an edge
5356/// let is_sample = vec![0, 1]; // Mark the child node as a sample.
54- /// let tsk_tables = forrustts::tskit::convert_to_tskit (
57+ /// let tsk_tables = forrustts::tskit::convert_to_tskit_minimal (
5558/// &tables,
5659/// &is_sample,
5760/// forrustts::tskit::simple_time_reverser(1),
@@ -61,7 +64,7 @@ pub fn simple_time_reverser(x: Time) -> Box<dyn Fn(Time) -> f64> {
6164/// assert_eq!(tsk_tables.edges().num_rows(), 1);
6265/// assert_eq!(tsk_tables.populations().num_rows(), 1);
6366/// ```
64- pub fn convert_to_tskit (
67+ pub fn convert_to_tskit_minimal (
6568 tables : & TableCollection ,
6669 is_sample : & [ i32 ] ,
6770 convert_time : impl Fn ( Time ) -> f64 ,
@@ -125,6 +128,9 @@ fn swap_with_empty<T>(v: &mut Vec<T>) {
125128/// If the input ``tables`` are not sorted, pass ``false`` for
126129/// `build_indexes`.
127130///
131+ /// This function will not be part of the long-term API.
132+ /// Rather, it is the minimum currently needed to get stuff done.
133+ ///
128134/// # Returns
129135///
130136/// A [``tskit_rust::TableCollection``].
@@ -137,7 +143,7 @@ fn swap_with_empty<T>(v: &mut Vec<T>) {
137143/// tables.add_node(1, 0).unwrap(); // Add a child node at time 1
138144/// tables.add_edge(0, 100, 0, 1).unwrap(); // Add an edge
139145/// let is_sample = vec![0, 1]; // Mark the child node as a sample.
140- /// let tsk_tables = forrustts::tskit::convert_to_tskit_and_drain (
146+ /// let tsk_tables = forrustts::tskit::convert_to_tskit_and_drain_minimal (
141147/// &is_sample,
142148/// forrustts::tskit::simple_time_reverser(1),
143149/// true,
@@ -155,7 +161,7 @@ fn swap_with_empty<T>(v: &mut Vec<T>) {
155161/// assert_eq!(tables.nodes().capacity(), 0);
156162/// assert_eq!(tables.edges().capacity(), 0);
157163/// ```
158- pub fn convert_to_tskit_and_drain (
164+ pub fn convert_to_tskit_and_drain_minimal (
159165 is_sample : & [ i32 ] ,
160166 convert_time : impl Fn ( Time ) -> f64 ,
161167 build_indexes : bool ,
@@ -209,7 +215,8 @@ mod tests {
209215 tables. add_node ( 1 , 0 ) . unwrap ( ) ; // Add a child node at time 1
210216 tables. add_edge ( 0 , 100 , 0 , 1 ) . unwrap ( ) ; // Add an edge
211217 let is_sample = vec ! [ 0 , 1 ] ; // Mark the child node as a sample.
212- let tsk_tables = convert_to_tskit ( & tables, & is_sample, simple_time_reverser ( 1 ) , true ) ;
218+ let tsk_tables =
219+ convert_to_tskit_minimal ( & tables, & is_sample, simple_time_reverser ( 1 ) , true ) ;
213220 assert_eq ! ( tsk_tables. nodes( ) . num_rows( ) , 2 ) ;
214221 assert_eq ! ( tsk_tables. edges( ) . num_rows( ) , 1 ) ;
215222 assert_eq ! ( tsk_tables. populations( ) . num_rows( ) , 1 ) ;
@@ -224,8 +231,12 @@ mod tests {
224231 tables. add_node ( 1 , 0 ) . unwrap ( ) ; // Add a child node at time 1
225232 tables. add_edge ( 0 , 100 , 0 , 1 ) . unwrap ( ) ; // Add an edge
226233 let is_sample = vec ! [ 0 , 1 ] ; // Mark the child node as a sample.
227- let tsk_tables =
228- convert_to_tskit_and_drain ( & is_sample, simple_time_reverser ( 1 ) , true , & mut tables) ;
234+ let tsk_tables = convert_to_tskit_and_drain_minimal (
235+ & is_sample,
236+ simple_time_reverser ( 1 ) ,
237+ true ,
238+ & mut tables,
239+ ) ;
229240 assert_eq ! ( tsk_tables. nodes( ) . num_rows( ) , 2 ) ;
230241 assert_eq ! ( tsk_tables. edges( ) . num_rows( ) , 1 ) ;
231242 assert_eq ! ( tsk_tables. populations( ) . num_rows( ) , 1 ) ;
0 commit comments