Skip to content

Commit 8427c2f

Browse files
authored
Change order of generics to match argument order for all "add" (#221)
functions of a TableCollection. Closes #220
1 parent 6ef0406 commit 8427c2f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/table_collection.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ impl TableCollection {
231231
}
232232

233233
/// Add a row to the individual table
234-
pub fn add_individual<I: Into<IndividualId>, L: Into<Location>>(
234+
pub fn add_individual<L: Into<Location>, I: Into<IndividualId>>(
235235
&mut self,
236236
flags: tsk_flags_t,
237237
location: &[L],
@@ -254,8 +254,8 @@ impl TableCollection {
254254

255255
/// Add a row with metadata to the individual table
256256
pub fn add_individual_with_metadata<
257-
I: Into<IndividualId>,
258257
L: Into<Location>,
258+
I: Into<IndividualId>,
259259
M: IndividualMetadata,
260260
>(
261261
&mut self,
@@ -356,7 +356,7 @@ impl TableCollection {
356356
}
357357

358358
/// Add a row to the node table
359-
pub fn add_node<I: Into<IndividualId>, POP: Into<PopulationId>, T: Into<Time>>(
359+
pub fn add_node<T: Into<Time>, POP: Into<PopulationId>, I: Into<IndividualId>>(
360360
&mut self,
361361
flags: ll_bindings::tsk_flags_t,
362362
time: T,
@@ -380,9 +380,9 @@ impl TableCollection {
380380

381381
/// Add a row with optional metadata to the node table
382382
pub fn add_node_with_metadata<
383-
I: Into<IndividualId>,
384-
POP: Into<PopulationId>,
385383
T: Into<Time>,
384+
POP: Into<PopulationId>,
385+
I: Into<IndividualId>,
386386
M: NodeMetadata,
387387
>(
388388
&mut self,
@@ -455,7 +455,7 @@ impl TableCollection {
455455
}
456456

457457
/// Add a row to the mutation table.
458-
pub fn add_mutation<N: Into<NodeId>, M: Into<MutationId>, S: Into<SiteId>, T: Into<Time>>(
458+
pub fn add_mutation<S: Into<SiteId>, N: Into<NodeId>, M: Into<MutationId>, T: Into<Time>>(
459459
&mut self,
460460
site: S,
461461
node: N,
@@ -482,9 +482,9 @@ impl TableCollection {
482482

483483
/// Add a row with optional metadata to the mutation table.
484484
pub fn add_mutation_with_metadata<
485+
S: Into<SiteId>,
485486
N: Into<NodeId>,
486487
M: Into<MutationId>,
487-
S: Into<SiteId>,
488488
MD: MutationMetadata,
489489
T: Into<Time>,
490490
>(
@@ -642,9 +642,9 @@ impl TableCollection {
642642
/// ```
643643
/// // Parent comes AFTER the child
644644
/// let mut tables = tskit::TableCollection::new(1.0).unwrap();
645-
/// let i0 = tables.add_individual::<i32, f64>(0,&[],&[1]).unwrap();
645+
/// let i0 = tables.add_individual::<f64, i32>(0,&[],&[1]).unwrap();
646646
/// assert_eq!(i0, 0);
647-
/// let i1 = tables.add_individual::<i32, f64>(0,&[],&[]).unwrap();
647+
/// let i1 = tables.add_individual::<f64, i32>(0,&[],&[]).unwrap();
648648
/// assert_eq!(i1, 1);
649649
/// let n0 = tables.add_node(0, 0.0, -1, i1).unwrap();
650650
/// assert_eq!(n0, 0);

0 commit comments

Comments
 (0)