@@ -622,13 +622,19 @@ macro_rules! node_table_add_row_details {
622
622
macro_rules! node_table_add_row {
623
623
( $( #[ $attr: meta] ) * => $name: ident, $self: ident, $table: ident $( , $table2: ident ) ?) => {
624
624
$( #[ $attr] ) *
625
- pub fn $name(
625
+ pub fn $name< F , T , P , I > (
626
626
& 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
+ {
632
638
node_table_add_row_details!( flags,
633
639
time,
634
640
population,
@@ -643,15 +649,19 @@ macro_rules! node_table_add_row {
643
649
macro_rules! node_table_add_row_with_metadata {
644
650
( $( #[ $attr: meta] ) * => $name: ident, $self: ident, $table: ident $( , $table2: ident ) ?) => {
645
651
$( #[ $attr] ) *
646
- pub fn $name<M >(
652
+ pub fn $name<F , T , P , I , M >(
647
653
& 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 ,
652
658
metadata: & M ,
653
659
) -> Result <$crate:: NodeId , $crate:: TskitError >
654
660
where
661
+ F : Into <$crate:: NodeFlags >,
662
+ T : Into <$crate:: Time >,
663
+ P : Into <$crate:: PopulationId >,
664
+ I : Into <$crate:: IndividualId >,
655
665
M : $crate:: metadata:: NodeMetadata ,
656
666
{
657
667
let md = $crate:: metadata:: EncodedMetadata :: new( metadata) ?;
@@ -692,13 +702,19 @@ macro_rules! edge_table_add_row_details {
692
702
macro_rules! edge_table_add_row {
693
703
( $( #[ $attr: meta] ) * => $name: ident, $self: ident, $table: expr) => {
694
704
$( #[ $attr] ) *
695
- pub fn $name(
705
+ pub fn $name< L , R , P , C > (
696
706
& 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
+ {
702
718
edge_table_add_row_details!( left,
703
719
right,
704
720
parent,
@@ -713,16 +729,21 @@ macro_rules! edge_table_add_row {
713
729
macro_rules! edge_table_add_row_with_metadata {
714
730
( $( #[ $attr: meta] ) * => $name: ident, $self: ident, $table: expr) => {
715
731
$( #[ $attr] ) *
716
- pub fn $name<M >(
732
+ pub fn $name<L , R , P , C , M >(
717
733
& 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 ,
722
738
metadata: & M ,
723
739
) -> Result <$crate:: EdgeId , $crate:: TskitError >
724
740
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
+ {
726
747
let md = $crate:: metadata:: EncodedMetadata :: new( metadata) ?;
727
748
edge_table_add_row_details!( left,
728
749
right,
@@ -793,11 +814,16 @@ macro_rules! individual_table_add_row_details {
793
814
macro_rules! individual_table_add_row {
794
815
( $( #[ $attr: meta] ) * => $name: ident, $self: ident, $table: expr) => {
795
816
$( #[ $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
+ {
801
827
individual_table_add_row_details!( flags,
802
828
location,
803
829
parents,
@@ -811,21 +837,26 @@ macro_rules! individual_table_add_row {
811
837
macro_rules! individual_table_add_row_with_metadata {
812
838
( $( #[ $attr: meta] ) * => $name: ident, $self: ident, $table: expr) => {
813
839
$( #[ $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 ,
818
844
metadata: & M ,
819
845
) -> 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
+ }
829
860
} ;
830
861
}
831
862
@@ -856,12 +887,17 @@ macro_rules! mutation_table_add_row_details {
856
887
macro_rules! mutation_table_add_row {
857
888
( $( #[ $attr: meta] ) * => $name: ident, $self: ident, $table: expr) => {
858
889
$( #[ $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 ,
864
895
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 >,
865
901
{
866
902
mutation_table_add_row_details!( site,
867
903
node,
@@ -878,14 +914,18 @@ macro_rules! mutation_table_add_row {
878
914
macro_rules! mutation_table_add_row_with_metadata {
879
915
( $( #[ $attr: meta] ) * => $name: ident, $self: ident, $table: expr) => {
880
916
$( #[ $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 >
888
924
where
925
+ S : Into <$crate:: SiteId >,
926
+ N : Into <$crate:: NodeId >,
927
+ P : Into <$crate:: MutationId >,
928
+ T : Into <$crate:: Time >,
889
929
M : $crate:: metadata:: MutationMetadata
890
930
{
891
931
let md = $crate:: metadata:: EncodedMetadata :: new( metadata) ?;
@@ -925,9 +965,12 @@ macro_rules! site_table_add_row_details {
925
965
macro_rules! site_table_add_row {
926
966
( $( #[ $attr: meta] ) * => $name: ident, $self: ident, $table: expr) => {
927
967
$( #[ $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
+ {
931
974
site_table_add_row_details!( position, ancestral_state,
932
975
std:: ptr:: null( ) , 0 , $table)
933
976
}
@@ -937,11 +980,14 @@ macro_rules! site_table_add_row {
937
980
macro_rules! site_table_add_row_with_metadata {
938
981
( $( #[ $attr: meta] ) * => $name: ident, $self: ident, $table: expr) => {
939
982
$( #[ $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 ,
942
985
ancestral_state: Option <& [ u8 ] >,
943
986
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
+ {
945
991
let md = $crate:: metadata:: EncodedMetadata :: new( metadata) ?;
946
992
site_table_add_row_details!( position, ancestral_state,
947
993
md. as_ptr( ) ,
@@ -979,12 +1025,20 @@ macro_rules! migration_table_add_row_details {
979
1025
macro_rules! migration_table_add_row {
980
1026
( $( #[ $attr: meta] ) * => $name: ident, $self: ident, $table: expr) => {
981
1027
$( #[ $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
+ {
988
1042
migration_table_add_row_details!( span, node, source_dest, time, std:: ptr:: null( ) , 0 , $table)
989
1043
}
990
1044
} ;
@@ -993,14 +1047,22 @@ macro_rules! migration_table_add_row {
993
1047
macro_rules! migration_table_add_row_with_metadata {
994
1048
( $( #[ $attr: meta] ) * => $name: ident, $self: ident, $table: expr) => {
995
1049
$( #[ $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 ,
1001
1055
metadata: & M )
1002
1056
-> 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
+ {
1004
1066
let md = $crate:: metadata:: EncodedMetadata :: new( metadata) ?;
1005
1067
migration_table_add_row_details!( span, node, source_dest, time,
1006
1068
md. as_ptr( ) , md. len( ) . into( ) , $table)
0 commit comments