@@ -1881,6 +1881,11 @@ public struct SuggestionProviderConstraints {
1881
1881
* settings record(s).
1882
1882
*/
1883
1883
public var exposureSuggestionTypes : [ String ] ?
1884
+ /**
1885
+ * Which strategy should we use for the AMP queries?
1886
+ * Use None for the default strategy.
1887
+ */
1888
+ public var ampAlternativeMatching : AmpMatchingStrategy ?
1884
1889
1885
1890
// Default memberwise initializers are never public by default, so we
1886
1891
// declare one manually.
@@ -1889,8 +1894,13 @@ public struct SuggestionProviderConstraints {
1889
1894
* `Exposure` provider - For each desired exposure suggestion type, this
1890
1895
* should contain the value of the `suggestion_type` field of its remote
1891
1896
* settings record(s).
1892
- */exposureSuggestionTypes: [ String ] ? = nil ) {
1897
+ */exposureSuggestionTypes: [ String ] ? = nil ,
1898
+ /**
1899
+ * Which strategy should we use for the AMP queries?
1900
+ * Use None for the default strategy.
1901
+ */ampAlternativeMatching: AmpMatchingStrategy ? = nil ) {
1893
1902
self . exposureSuggestionTypes = exposureSuggestionTypes
1903
+ self . ampAlternativeMatching = ampAlternativeMatching
1894
1904
}
1895
1905
}
1896
1906
@@ -1901,11 +1911,15 @@ extension SuggestionProviderConstraints: Equatable, Hashable {
1901
1911
if lhs. exposureSuggestionTypes != rhs. exposureSuggestionTypes {
1902
1912
return false
1903
1913
}
1914
+ if lhs. ampAlternativeMatching != rhs. ampAlternativeMatching {
1915
+ return false
1916
+ }
1904
1917
return true
1905
1918
}
1906
1919
1907
1920
public func hash( into hasher: inout Hasher ) {
1908
1921
hasher. combine ( exposureSuggestionTypes)
1922
+ hasher. combine ( ampAlternativeMatching)
1909
1923
}
1910
1924
}
1911
1925
@@ -1917,12 +1931,14 @@ public struct FfiConverterTypeSuggestionProviderConstraints: FfiConverterRustBuf
1917
1931
public static func read( from buf: inout ( data: Data , offset: Data . Index ) ) throws -> SuggestionProviderConstraints {
1918
1932
return
1919
1933
try SuggestionProviderConstraints (
1920
- exposureSuggestionTypes: FfiConverterOptionSequenceString . read ( from: & buf)
1934
+ exposureSuggestionTypes: FfiConverterOptionSequenceString . read ( from: & buf) ,
1935
+ ampAlternativeMatching: FfiConverterOptionTypeAmpMatchingStrategy . read ( from: & buf)
1921
1936
)
1922
1937
}
1923
1938
1924
1939
public static func write( _ value: SuggestionProviderConstraints , into buf: inout [ UInt8 ] ) {
1925
1940
FfiConverterOptionSequenceString . write ( value. exposureSuggestionTypes, into: & buf)
1941
+ FfiConverterOptionTypeAmpMatchingStrategy . write ( value. ampAlternativeMatching, into: & buf)
1926
1942
}
1927
1943
}
1928
1944
@@ -2026,6 +2042,88 @@ public func FfiConverterTypeSuggestionQuery_lower(_ value: SuggestionQuery) -> R
2026
2042
return FfiConverterTypeSuggestionQuery . lower ( value)
2027
2043
}
2028
2044
2045
+ // Note that we don't yet support `indirect` for enums.
2046
+ // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
2047
+
2048
+ public enum AmpMatchingStrategy {
2049
+
2050
+ /**
2051
+ * Disable keywords added via keyword expansion.
2052
+ * This eliminates keywords that for terms related to the "real" keywords, for example
2053
+ * misspellings like "underarmor" instead of "under armor"'.
2054
+ */
2055
+ case noKeywordExpansion
2056
+ /**
2057
+ * Use FTS matching against the full keywords, joined together.
2058
+ */
2059
+ case ftsAgainstFullKeywords
2060
+ /**
2061
+ * Use FTS matching against the title field
2062
+ */
2063
+ case ftsAgainstTitle
2064
+ }
2065
+
2066
+
2067
+ #if swift(>=5.8)
2068
+ @_documentation ( visibility: private)
2069
+ #endif
2070
+ public struct FfiConverterTypeAmpMatchingStrategy : FfiConverterRustBuffer {
2071
+ typealias SwiftType = AmpMatchingStrategy
2072
+
2073
+ public static func read( from buf: inout ( data: Data , offset: Data . Index ) ) throws -> AmpMatchingStrategy {
2074
+ let variant : Int32 = try readInt ( & buf)
2075
+ switch variant {
2076
+
2077
+ case 1 : return . noKeywordExpansion
2078
+
2079
+ case 2 : return . ftsAgainstFullKeywords
2080
+
2081
+ case 3 : return . ftsAgainstTitle
2082
+
2083
+ default : throw UniffiInternalError . unexpectedEnumCase
2084
+ }
2085
+ }
2086
+
2087
+ public static func write( _ value: AmpMatchingStrategy , into buf: inout [ UInt8 ] ) {
2088
+ switch value {
2089
+
2090
+
2091
+ case . noKeywordExpansion:
2092
+ writeInt ( & buf, Int32 ( 1 ) )
2093
+
2094
+
2095
+ case . ftsAgainstFullKeywords:
2096
+ writeInt ( & buf, Int32 ( 2 ) )
2097
+
2098
+
2099
+ case . ftsAgainstTitle:
2100
+ writeInt ( & buf, Int32 ( 3 ) )
2101
+
2102
+ }
2103
+ }
2104
+ }
2105
+
2106
+
2107
+ #if swift(>=5.8)
2108
+ @_documentation ( visibility: private)
2109
+ #endif
2110
+ public func FfiConverterTypeAmpMatchingStrategy_lift( _ buf: RustBuffer ) throws -> AmpMatchingStrategy {
2111
+ return try FfiConverterTypeAmpMatchingStrategy . lift ( buf)
2112
+ }
2113
+
2114
+ #if swift(>=5.8)
2115
+ @_documentation ( visibility: private)
2116
+ #endif
2117
+ public func FfiConverterTypeAmpMatchingStrategy_lower( _ value: AmpMatchingStrategy ) -> RustBuffer {
2118
+ return FfiConverterTypeAmpMatchingStrategy . lower ( value)
2119
+ }
2120
+
2121
+
2122
+
2123
+ extension AmpMatchingStrategy : Equatable , Hashable { }
2124
+
2125
+
2126
+
2029
2127
// Note that we don't yet support `indirect` for enums.
2030
2128
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
2031
2129
@@ -2881,6 +2979,30 @@ fileprivate struct FfiConverterOptionTypeSuggestionProviderConstraints: FfiConve
2881
2979
}
2882
2980
}
2883
2981
2982
+ #if swift(>=5.8)
2983
+ @_documentation ( visibility: private)
2984
+ #endif
2985
+ fileprivate struct FfiConverterOptionTypeAmpMatchingStrategy : FfiConverterRustBuffer {
2986
+ typealias SwiftType = AmpMatchingStrategy ?
2987
+
2988
+ public static func write( _ value: SwiftType , into buf: inout [ UInt8 ] ) {
2989
+ guard let value = value else {
2990
+ writeInt ( & buf, Int8 ( 0 ) )
2991
+ return
2992
+ }
2993
+ writeInt ( & buf, Int8 ( 1 ) )
2994
+ FfiConverterTypeAmpMatchingStrategy . write ( value, into: & buf)
2995
+ }
2996
+
2997
+ public static func read( from buf: inout ( data: Data , offset: Data . Index ) ) throws -> SwiftType {
2998
+ switch try readInt ( & buf) as Int8 {
2999
+ case 0 : return nil
3000
+ case 1 : return try FfiConverterTypeAmpMatchingStrategy . read ( from: & buf)
3001
+ default : throw UniffiInternalError . unexpectedOptionalTag
3002
+ }
3003
+ }
3004
+ }
3005
+
2884
3006
#if swift(>=5.8)
2885
3007
@_documentation ( visibility: private)
2886
3008
#endif
0 commit comments