@@ -843,14 +843,16 @@ impl Signature {
843
843
volatility,
844
844
}
845
845
}
846
+
846
847
/// Any one of a list of [TypeSignature]s.
847
848
pub fn one_of ( type_signatures : Vec < TypeSignature > , volatility : Volatility ) -> Self {
848
849
Signature {
849
850
type_signature : TypeSignature :: OneOf ( type_signatures) ,
850
851
volatility,
851
852
}
852
853
}
853
- /// Specialized Signature for ArrayAppend and similar functions
854
+
855
+ /// Specialized [Signature] for ArrayAppend and similar functions.
854
856
pub fn array_and_element ( volatility : Volatility ) -> Self {
855
857
Signature {
856
858
type_signature : TypeSignature :: ArraySignature (
@@ -865,7 +867,41 @@ impl Signature {
865
867
volatility,
866
868
}
867
869
}
868
- /// Specialized Signature for Array functions with an optional index
870
+
871
+ /// Specialized [Signature] for ArrayPrepend and similar functions.
872
+ pub fn element_and_array ( volatility : Volatility ) -> Self {
873
+ Signature {
874
+ type_signature : TypeSignature :: ArraySignature (
875
+ ArrayFunctionSignature :: Array {
876
+ arguments : vec ! [
877
+ ArrayFunctionArgument :: Element ,
878
+ ArrayFunctionArgument :: Array ,
879
+ ] ,
880
+ array_coercion : Some ( ListCoercion :: FixedSizedListToList ) ,
881
+ } ,
882
+ ) ,
883
+ volatility,
884
+ }
885
+ }
886
+
887
+ /// Specialized [Signature] for functions that take a fixed number of arrays.
888
+ pub fn arrays (
889
+ n : usize ,
890
+ coercion : Option < ListCoercion > ,
891
+ volatility : Volatility ,
892
+ ) -> Self {
893
+ Signature {
894
+ type_signature : TypeSignature :: ArraySignature (
895
+ ArrayFunctionSignature :: Array {
896
+ arguments : vec ! [ ArrayFunctionArgument :: Array ; n] ,
897
+ array_coercion : coercion,
898
+ } ,
899
+ ) ,
900
+ volatility,
901
+ }
902
+ }
903
+
904
+ /// Specialized [Signature] for Array functions with an optional index.
869
905
pub fn array_and_element_and_optional_index ( volatility : Volatility ) -> Self {
870
906
Signature {
871
907
type_signature : TypeSignature :: OneOf ( vec ! [
@@ -889,7 +925,7 @@ impl Signature {
889
925
}
890
926
}
891
927
892
- /// Specialized Signature for ArrayElement and similar functions
928
+ /// Specialized [ Signature] for ArrayElement and similar functions.
893
929
pub fn array_and_index ( volatility : Volatility ) -> Self {
894
930
Signature {
895
931
type_signature : TypeSignature :: ArraySignature (
@@ -898,23 +934,16 @@ impl Signature {
898
934
ArrayFunctionArgument :: Array ,
899
935
ArrayFunctionArgument :: Index ,
900
936
] ,
901
- array_coercion : None ,
937
+ array_coercion : Some ( ListCoercion :: FixedSizedListToList ) ,
902
938
} ,
903
939
) ,
904
940
volatility,
905
941
}
906
942
}
907
- /// Specialized Signature for ArrayEmpty and similar functions
943
+
944
+ /// Specialized [Signature] for ArrayEmpty and similar functions.
908
945
pub fn array ( volatility : Volatility ) -> Self {
909
- Signature {
910
- type_signature : TypeSignature :: ArraySignature (
911
- ArrayFunctionSignature :: Array {
912
- arguments : vec ! [ ArrayFunctionArgument :: Array ] ,
913
- array_coercion : None ,
914
- } ,
915
- ) ,
916
- volatility,
917
- }
946
+ Signature :: arrays ( 1 , Some ( ListCoercion :: FixedSizedListToList ) , volatility)
918
947
}
919
948
}
920
949
0 commit comments