@@ -622,13 +622,19 @@ macro_rules! node_table_add_row_details {
622622macro_rules! node_table_add_row {
623623 ( $( #[ $attr: meta] ) * => $name: ident, $self: ident, $table: ident $( , $table2: ident ) ?) => {
624624 $( #[ $attr] ) *
625- pub fn $name(
625+ pub fn $name< F , T , P , I > (
626626 & mut $self,
627- flags: impl Into <$crate:: NodeFlags >,
628- time: impl Into <$crate:: Time >,
629- population: impl Into <$crate:: PopulationId >,
630- individual: impl Into <$crate:: IndividualId >,
631- ) -> Result <$crate:: NodeId , $crate:: TskitError > {
627+ flags: F ,
628+ time: T ,
629+ population: P ,
630+ individual: I ,
631+ ) -> Result <$crate:: NodeId , $crate:: TskitError >
632+ where
633+ F : Into <$crate:: NodeFlags >,
634+ T : Into <$crate:: Time >,
635+ P : Into <$crate:: PopulationId >,
636+ I : Into <$crate:: IndividualId >
637+ {
632638 node_table_add_row_details!( flags,
633639 time,
634640 population,
@@ -643,15 +649,19 @@ macro_rules! node_table_add_row {
643649macro_rules! node_table_add_row_with_metadata {
644650 ( $( #[ $attr: meta] ) * => $name: ident, $self: ident, $table: ident $( , $table2: ident ) ?) => {
645651 $( #[ $attr] ) *
646- pub fn $name<M >(
652+ pub fn $name<F , T , P , I , M >(
647653 & mut $self,
648- flags: impl Into <$crate :: NodeFlags > ,
649- time: impl Into <$crate :: Time > ,
650- population: impl Into <$crate :: PopulationId > ,
651- individual: impl Into <$crate :: IndividualId > ,
654+ flags: F ,
655+ time: T ,
656+ population: P ,
657+ individual: I ,
652658 metadata: & M ,
653659 ) -> Result <$crate:: NodeId , $crate:: TskitError >
654660 where
661+ F : Into <$crate:: NodeFlags >,
662+ T : Into <$crate:: Time >,
663+ P : Into <$crate:: PopulationId >,
664+ I : Into <$crate:: IndividualId >,
655665 M : $crate:: metadata:: NodeMetadata ,
656666 {
657667 let md = $crate:: metadata:: EncodedMetadata :: new( metadata) ?;
@@ -692,13 +702,19 @@ macro_rules! edge_table_add_row_details {
692702macro_rules! edge_table_add_row {
693703 ( $( #[ $attr: meta] ) * => $name: ident, $self: ident, $table: expr) => {
694704 $( #[ $attr] ) *
695- pub fn $name(
705+ pub fn $name< L , R , P , C > (
696706 & mut $self,
697- left: impl Into <$crate:: Position >,
698- right: impl Into <$crate:: Position >,
699- parent: impl Into <$crate:: NodeId >,
700- child: impl Into <$crate:: NodeId >,
701- ) -> Result <$crate:: EdgeId , $crate:: TskitError > {
707+ left: L ,
708+ right: R ,
709+ parent: P ,
710+ child: C ,
711+ ) -> Result <$crate:: EdgeId , $crate:: TskitError >
712+ where
713+ L : Into <$crate:: Position >,
714+ R : Into <$crate:: Position >,
715+ P : Into <$crate:: NodeId >,
716+ C : Into <$crate:: NodeId >,
717+ {
702718 edge_table_add_row_details!( left,
703719 right,
704720 parent,
@@ -713,16 +729,21 @@ macro_rules! edge_table_add_row {
713729macro_rules! edge_table_add_row_with_metadata {
714730 ( $( #[ $attr: meta] ) * => $name: ident, $self: ident, $table: expr) => {
715731 $( #[ $attr] ) *
716- pub fn $name<M >(
732+ pub fn $name<L , R , P , C , M >(
717733 & mut $self,
718- left: impl Into <$crate :: Position > ,
719- right: impl Into <$crate :: Position > ,
720- parent: impl Into <$crate :: NodeId > ,
721- child: impl Into <$crate :: NodeId > ,
734+ left: L ,
735+ right: R ,
736+ parent: P ,
737+ child: C ,
722738 metadata: & M ,
723739 ) -> Result <$crate:: EdgeId , $crate:: TskitError >
724740 where
725- M : $crate:: metadata:: EdgeMetadata {
741+ L : Into <$crate:: Position >,
742+ R : Into <$crate:: Position >,
743+ P : Into <$crate:: NodeId >,
744+ C : Into <$crate:: NodeId >,
745+ M : $crate:: metadata:: EdgeMetadata
746+ {
726747 let md = $crate:: metadata:: EncodedMetadata :: new( metadata) ?;
727748 edge_table_add_row_details!( left,
728749 right,
@@ -793,11 +814,16 @@ macro_rules! individual_table_add_row_details {
793814macro_rules! individual_table_add_row {
794815 ( $( #[ $attr: meta] ) * => $name: ident, $self: ident, $table: expr) => {
795816 $( #[ $attr] ) *
796- pub fn $name( & mut $self,
797- flags: impl Into <$crate:: IndividualFlags >,
798- location: impl $crate:: IndividualLocation ,
799- parents: impl $crate:: IndividualParents ,
800- ) -> Result <$crate:: IndividualId , $crate:: TskitError > {
817+ pub fn $name<F , L , P >( & mut $self,
818+ flags: F ,
819+ location: L ,
820+ parents: P ,
821+ ) -> Result <$crate:: IndividualId , $crate:: TskitError >
822+ where
823+ F : Into <$crate:: IndividualFlags >,
824+ L : $crate:: IndividualLocation ,
825+ P : $crate:: IndividualParents ,
826+ {
801827 individual_table_add_row_details!( flags,
802828 location,
803829 parents,
@@ -811,21 +837,26 @@ macro_rules! individual_table_add_row {
811837macro_rules! individual_table_add_row_with_metadata {
812838 ( $( #[ $attr: meta] ) * => $name: ident, $self: ident, $table: expr) => {
813839 $( #[ $attr] ) *
814- pub fn $name<M >( & mut $self,
815- flags: impl Into <$crate :: IndividualFlags > ,
816- location: impl $crate :: IndividualLocation ,
817- parents: impl $crate :: IndividualParents ,
840+ pub fn $name<F , L , P , M >( & mut $self,
841+ flags: F ,
842+ location: L ,
843+ parents: P ,
818844 metadata: & M ,
819845 ) -> Result <$crate:: IndividualId , $crate:: TskitError >
820- where M : $crate:: metadata:: IndividualMetadata {
821- let md = $crate:: metadata:: EncodedMetadata :: new( metadata) ?;
822- individual_table_add_row_details!( flags,
823- location,
824- parents,
825- md. as_ptr( ) ,
826- md. len( ) . into( ) ,
827- $table)
828- }
846+ where
847+ F : Into <$crate:: IndividualFlags >,
848+ L : $crate:: IndividualLocation ,
849+ P : $crate:: IndividualParents ,
850+ M : $crate:: metadata:: IndividualMetadata
851+ {
852+ let md = $crate:: metadata:: EncodedMetadata :: new( metadata) ?;
853+ individual_table_add_row_details!( flags,
854+ location,
855+ parents,
856+ md. as_ptr( ) ,
857+ md. len( ) . into( ) ,
858+ $table)
859+ }
829860 } ;
830861}
831862
@@ -856,12 +887,17 @@ macro_rules! mutation_table_add_row_details {
856887macro_rules! mutation_table_add_row {
857888 ( $( #[ $attr: meta] ) * => $name: ident, $self: ident, $table: expr) => {
858889 $( #[ $attr] ) *
859- pub fn $name( & mut $self,
860- site: impl Into <$crate :: SiteId > ,
861- node: impl Into <$crate :: NodeId > ,
862- parent: impl Into <$crate :: MutationId > ,
863- time: impl Into <$crate :: Time > ,
890+ pub fn $name< S , N , P , T > ( & mut $self,
891+ site: S ,
892+ node: N ,
893+ parent: P ,
894+ time: T ,
864895 derived_state: Option <& [ u8 ] >) -> Result <$crate:: MutationId , $crate:: TskitError >
896+ where
897+ S : Into <$crate:: SiteId >,
898+ N : Into <$crate:: NodeId >,
899+ P : Into <$crate:: MutationId >,
900+ T : Into <$crate:: Time >,
865901 {
866902 mutation_table_add_row_details!( site,
867903 node,
@@ -878,14 +914,18 @@ macro_rules! mutation_table_add_row {
878914macro_rules! mutation_table_add_row_with_metadata {
879915 ( $( #[ $attr: meta] ) * => $name: ident, $self: ident, $table: expr) => {
880916 $( #[ $attr] ) *
881- pub fn $name<M >( & mut $self,
882- site : impl Into <$crate :: SiteId > ,
883- node : impl Into <$crate :: NodeId > ,
884- parent : impl Into <$crate :: MutationId > ,
885- time : impl Into <$crate :: Time > ,
886- derived_state: Option <& [ u8 ] >,
887- metadata: & M ) -> Result <$crate:: MutationId , $crate:: TskitError >
917+ pub fn $name<S , N , P , T , M >( & mut $self,
918+ site : S ,
919+ node : N ,
920+ parent : P ,
921+ time : T ,
922+ derived_state: Option <& [ u8 ] >,
923+ metadata: & M ) -> Result <$crate:: MutationId , $crate:: TskitError >
888924 where
925+ S : Into <$crate:: SiteId >,
926+ N : Into <$crate:: NodeId >,
927+ P : Into <$crate:: MutationId >,
928+ T : Into <$crate:: Time >,
889929 M : $crate:: metadata:: MutationMetadata
890930 {
891931 let md = $crate:: metadata:: EncodedMetadata :: new( metadata) ?;
@@ -925,9 +965,12 @@ macro_rules! site_table_add_row_details {
925965macro_rules! site_table_add_row {
926966 ( $( #[ $attr: meta] ) * => $name: ident, $self: ident, $table: expr) => {
927967 $( #[ $attr] ) *
928- pub fn $name( & mut $self,
929- position: impl Into <$crate:: Position >,
930- ancestral_state: Option <& [ u8 ] >) -> Result <$crate:: SiteId , $crate:: TskitError > {
968+ pub fn $name<P >( & mut $self,
969+ position: P ,
970+ ancestral_state: Option <& [ u8 ] >) -> Result <$crate:: SiteId , $crate:: TskitError >
971+ where
972+ P : Into <$crate:: Position >,
973+ {
931974 site_table_add_row_details!( position, ancestral_state,
932975 std:: ptr:: null( ) , 0 , $table)
933976 }
@@ -937,11 +980,14 @@ macro_rules! site_table_add_row {
937980macro_rules! site_table_add_row_with_metadata {
938981 ( $( #[ $attr: meta] ) * => $name: ident, $self: ident, $table: expr) => {
939982 $( #[ $attr] ) *
940- pub fn $name<M >( & mut $self,
941- position: impl Into <$crate :: Position > ,
983+ pub fn $name<P , M >( & mut $self,
984+ position: P ,
942985 ancestral_state: Option <& [ u8 ] >,
943986 metadata: & M ) -> Result <$crate:: SiteId , $crate:: TskitError >
944- where M : $crate:: metadata:: SiteMetadata {
987+ where
988+ P : Into <$crate:: Position >,
989+ M : $crate:: metadata:: SiteMetadata
990+ {
945991 let md = $crate:: metadata:: EncodedMetadata :: new( metadata) ?;
946992 site_table_add_row_details!( position, ancestral_state,
947993 md. as_ptr( ) ,
@@ -979,12 +1025,20 @@ macro_rules! migration_table_add_row_details {
9791025macro_rules! migration_table_add_row {
9801026 ( $( #[ $attr: meta] ) * => $name: ident, $self: ident, $table: expr) => {
9811027 $( #[ $attr] ) *
982- pub fn $name( & mut $self,
983- span: ( impl Into <$crate:: Position >, impl Into <$crate:: Position >) ,
984- node: impl Into <$crate:: NodeId >,
985- source_dest: ( impl Into <$crate:: PopulationId >, impl Into <$crate:: PopulationId >) ,
986- time: impl Into <$crate:: Time >)
987- -> Result <$crate:: MigrationId , $crate:: TskitError > {
1028+ pub fn $name<LEFT , RIGHT , N , SOURCE , DEST , T >( & mut $self,
1029+ span: ( LEFT , RIGHT ) ,
1030+ node: N ,
1031+ source_dest: ( SOURCE , DEST ) ,
1032+ time: T )
1033+ -> Result <$crate:: MigrationId , $crate:: TskitError >
1034+ where
1035+ LEFT : Into <$crate:: Position >,
1036+ RIGHT : Into <$crate:: Position >,
1037+ N : Into <$crate:: NodeId >,
1038+ SOURCE : Into <$crate:: PopulationId >,
1039+ DEST : Into <$crate:: PopulationId >,
1040+ T : Into <$crate:: Time >,
1041+ {
9881042 migration_table_add_row_details!( span, node, source_dest, time, std:: ptr:: null( ) , 0 , $table)
9891043 }
9901044 } ;
@@ -993,14 +1047,22 @@ macro_rules! migration_table_add_row {
9931047macro_rules! migration_table_add_row_with_metadata {
9941048 ( $( #[ $attr: meta] ) * => $name: ident, $self: ident, $table: expr) => {
9951049 $( #[ $attr] ) *
996- pub fn $name<M >( & mut $self,
997- span: ( impl Into <$crate :: Position > , impl Into <$crate :: Position > ) ,
998- node: impl Into <$crate :: NodeId > ,
999- source_dest: ( impl Into <$crate :: PopulationId > , impl Into <$crate :: PopulationId > ) ,
1000- time: impl Into <$crate :: Time > ,
1050+ pub fn $name<LEFT , RIGHT , N , SOURCE , DEST , T , M >( & mut $self,
1051+ span: ( LEFT , RIGHT ) ,
1052+ node: N ,
1053+ source_dest: ( SOURCE , DEST ) ,
1054+ time: T ,
10011055 metadata: & M )
10021056 -> Result <$crate:: MigrationId , $crate:: TskitError >
1003- where M : $crate:: metadata:: MigrationMetadata {
1057+ where
1058+ LEFT : Into <$crate:: Position >,
1059+ RIGHT : Into <$crate:: Position >,
1060+ N : Into <$crate:: NodeId >,
1061+ SOURCE : Into <$crate:: PopulationId >,
1062+ DEST : Into <$crate:: PopulationId >,
1063+ T : Into <$crate:: Time >,
1064+ M : $crate:: metadata:: MigrationMetadata
1065+ {
10041066 let md = $crate:: metadata:: EncodedMetadata :: new( metadata) ?;
10051067 migration_table_add_row_details!( span, node, source_dest, time,
10061068 md. as_ptr( ) , md. len( ) . into( ) , $table)
0 commit comments