Skip to content

Commit

Permalink
Change order of generics to match argument order for all "add" (#221)
Browse files Browse the repository at this point in the history
functions of a TableCollection.

Closes #220
  • Loading branch information
molpopgen authored Mar 24, 2022
1 parent 6ef0406 commit 8427c2f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/table_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ impl TableCollection {
}

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

/// Add a row with metadata to the individual table
pub fn add_individual_with_metadata<
I: Into<IndividualId>,
L: Into<Location>,
I: Into<IndividualId>,
M: IndividualMetadata,
>(
&mut self,
Expand Down Expand Up @@ -356,7 +356,7 @@ impl TableCollection {
}

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

/// Add a row with optional metadata to the node table
pub fn add_node_with_metadata<
I: Into<IndividualId>,
POP: Into<PopulationId>,
T: Into<Time>,
POP: Into<PopulationId>,
I: Into<IndividualId>,
M: NodeMetadata,
>(
&mut self,
Expand Down Expand Up @@ -455,7 +455,7 @@ impl TableCollection {
}

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

/// Add a row with optional metadata to the mutation table.
pub fn add_mutation_with_metadata<
S: Into<SiteId>,
N: Into<NodeId>,
M: Into<MutationId>,
S: Into<SiteId>,
MD: MutationMetadata,
T: Into<Time>,
>(
Expand Down Expand Up @@ -642,9 +642,9 @@ impl TableCollection {
/// ```
/// // Parent comes AFTER the child
/// let mut tables = tskit::TableCollection::new(1.0).unwrap();
/// let i0 = tables.add_individual::<i32, f64>(0,&[],&[1]).unwrap();
/// let i0 = tables.add_individual::<f64, i32>(0,&[],&[1]).unwrap();
/// assert_eq!(i0, 0);
/// let i1 = tables.add_individual::<i32, f64>(0,&[],&[]).unwrap();
/// let i1 = tables.add_individual::<f64, i32>(0,&[],&[]).unwrap();
/// assert_eq!(i1, 1);
/// let n0 = tables.add_node(0, 0.0, -1, i1).unwrap();
/// assert_eq!(n0, 0);
Expand Down

0 comments on commit 8427c2f

Please sign in to comment.