@@ -424,6 +424,8 @@ fileprivate struct FfiConverterString: FfiConverter {
424
424
425
425
public protocol SuggestStoreProtocol {
426
426
func clear( ) throws
427
+ func fetchGlobalConfig( ) throws -> SuggestGlobalConfig
428
+ func fetchProviderConfig( provider: SuggestionProvider ) throws -> SuggestProviderConfig ?
427
429
func ingest( constraints: SuggestIngestionConstraints ) throws
428
430
func interrupt( )
429
431
func query( query: SuggestionQuery ) throws -> [ Suggestion ]
@@ -464,6 +466,27 @@ public class SuggestStore: SuggestStoreProtocol {
464
466
}
465
467
}
466
468
469
+ public func fetchGlobalConfig( ) throws -> SuggestGlobalConfig {
470
+ return try FfiConverterTypeSuggestGlobalConfig . lift (
471
+ try
472
+ rustCallWithError ( FfiConverterTypeSuggestApiError . lift) {
473
+ uniffi_suggest_fn_method_suggeststore_fetch_global_config ( self . pointer, $0
474
+ )
475
+ }
476
+ )
477
+ }
478
+
479
+ public func fetchProviderConfig( provider: SuggestionProvider ) throws -> SuggestProviderConfig ? {
480
+ return try FfiConverterOptionTypeSuggestProviderConfig . lift (
481
+ try
482
+ rustCallWithError ( FfiConverterTypeSuggestApiError . lift) {
483
+ uniffi_suggest_fn_method_suggeststore_fetch_provider_config ( self . pointer,
484
+ FfiConverterTypeSuggestionProvider . lower ( provider) , $0
485
+ )
486
+ }
487
+ )
488
+ }
489
+
467
490
public func ingest( constraints: SuggestIngestionConstraints ) throws {
468
491
try
469
492
rustCallWithError ( FfiConverterTypeSuggestApiError . lift) {
@@ -653,6 +676,53 @@ public func FfiConverterTypeSuggestStoreBuilder_lower(_ value: SuggestStoreBuild
653
676
}
654
677
655
678
679
+ public struct SuggestGlobalConfig {
680
+ public var showLessFrequentlyCap : Int32
681
+
682
+ // Default memberwise initializers are never public by default, so we
683
+ // declare one manually.
684
+ public init ( showLessFrequentlyCap: Int32 ) {
685
+ self . showLessFrequentlyCap = showLessFrequentlyCap
686
+ }
687
+ }
688
+
689
+
690
+ extension SuggestGlobalConfig : Equatable , Hashable {
691
+ public static func == ( lhs: SuggestGlobalConfig , rhs: SuggestGlobalConfig ) -> Bool {
692
+ if lhs. showLessFrequentlyCap != rhs. showLessFrequentlyCap {
693
+ return false
694
+ }
695
+ return true
696
+ }
697
+
698
+ public func hash( into hasher: inout Hasher ) {
699
+ hasher. combine ( showLessFrequentlyCap)
700
+ }
701
+ }
702
+
703
+
704
+ public struct FfiConverterTypeSuggestGlobalConfig : FfiConverterRustBuffer {
705
+ public static func read( from buf: inout ( data: Data , offset: Data . Index ) ) throws -> SuggestGlobalConfig {
706
+ return try SuggestGlobalConfig (
707
+ showLessFrequentlyCap: FfiConverterInt32 . read ( from: & buf)
708
+ )
709
+ }
710
+
711
+ public static func write( _ value: SuggestGlobalConfig , into buf: inout [ UInt8 ] ) {
712
+ FfiConverterInt32 . write ( value. showLessFrequentlyCap, into: & buf)
713
+ }
714
+ }
715
+
716
+
717
+ public func FfiConverterTypeSuggestGlobalConfig_lift( _ buf: RustBuffer ) throws -> SuggestGlobalConfig {
718
+ return try FfiConverterTypeSuggestGlobalConfig . lift ( buf)
719
+ }
720
+
721
+ public func FfiConverterTypeSuggestGlobalConfig_lower( _ value: SuggestGlobalConfig ) -> RustBuffer {
722
+ return FfiConverterTypeSuggestGlobalConfig . lower ( value)
723
+ }
724
+
725
+
656
726
public struct SuggestIngestionConstraints {
657
727
public var maxSuggestions : UInt64 ?
658
728
@@ -836,6 +906,54 @@ extension SuggestApiError: Equatable, Hashable {}
836
906
837
907
extension SuggestApiError : Error { }
838
908
909
+ // Note that we don't yet support `indirect` for enums.
910
+ // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
911
+ public enum SuggestProviderConfig {
912
+
913
+ case weather( minKeywordLength: Int32 )
914
+ }
915
+
916
+ public struct FfiConverterTypeSuggestProviderConfig : FfiConverterRustBuffer {
917
+ typealias SwiftType = SuggestProviderConfig
918
+
919
+ public static func read( from buf: inout ( data: Data , offset: Data . Index ) ) throws -> SuggestProviderConfig {
920
+ let variant : Int32 = try readInt ( & buf)
921
+ switch variant {
922
+
923
+ case 1 : return . weather(
924
+ minKeywordLength: try FfiConverterInt32 . read ( from: & buf)
925
+ )
926
+
927
+ default : throw UniffiInternalError . unexpectedEnumCase
928
+ }
929
+ }
930
+
931
+ public static func write( _ value: SuggestProviderConfig , into buf: inout [ UInt8 ] ) {
932
+ switch value {
933
+
934
+
935
+ case let . weather( minKeywordLength) :
936
+ writeInt ( & buf, Int32 ( 1 ) )
937
+ FfiConverterInt32 . write ( minKeywordLength, into: & buf)
938
+
939
+ }
940
+ }
941
+ }
942
+
943
+
944
+ public func FfiConverterTypeSuggestProviderConfig_lift( _ buf: RustBuffer ) throws -> SuggestProviderConfig {
945
+ return try FfiConverterTypeSuggestProviderConfig . lift ( buf)
946
+ }
947
+
948
+ public func FfiConverterTypeSuggestProviderConfig_lower( _ value: SuggestProviderConfig ) -> RustBuffer {
949
+ return FfiConverterTypeSuggestProviderConfig . lower ( value)
950
+ }
951
+
952
+
953
+ extension SuggestProviderConfig : Equatable , Hashable { }
954
+
955
+
956
+
839
957
// Note that we don't yet support `indirect` for enums.
840
958
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
841
959
public enum Suggestion {
@@ -1152,6 +1270,27 @@ fileprivate struct FfiConverterOptionString: FfiConverterRustBuffer {
1152
1270
}
1153
1271
}
1154
1272
1273
+ fileprivate struct FfiConverterOptionTypeSuggestProviderConfig : FfiConverterRustBuffer {
1274
+ typealias SwiftType = SuggestProviderConfig ?
1275
+
1276
+ public static func write( _ value: SwiftType , into buf: inout [ UInt8 ] ) {
1277
+ guard let value = value else {
1278
+ writeInt ( & buf, Int8 ( 0 ) )
1279
+ return
1280
+ }
1281
+ writeInt ( & buf, Int8 ( 1 ) )
1282
+ FfiConverterTypeSuggestProviderConfig . write ( value, into: & buf)
1283
+ }
1284
+
1285
+ public static func read( from buf: inout ( data: Data , offset: Data . Index ) ) throws -> SwiftType {
1286
+ switch try readInt ( & buf) as Int8 {
1287
+ case 0 : return nil
1288
+ case 1 : return try FfiConverterTypeSuggestProviderConfig . read ( from: & buf)
1289
+ default : throw UniffiInternalError . unexpectedOptionalTag
1290
+ }
1291
+ }
1292
+ }
1293
+
1155
1294
fileprivate struct FfiConverterOptionSequenceUInt8 : FfiConverterRustBuffer {
1156
1295
typealias SwiftType = [ UInt8 ] ?
1157
1296
@@ -1293,6 +1432,12 @@ private var initializationResult: InitializationResult {
1293
1432
if ( uniffi_suggest_checksum_method_suggeststore_clear ( ) != 23581 ) {
1294
1433
return InitializationResult . apiChecksumMismatch
1295
1434
}
1435
+ if ( uniffi_suggest_checksum_method_suggeststore_fetch_global_config ( ) != 62773 ) {
1436
+ return InitializationResult . apiChecksumMismatch
1437
+ }
1438
+ if ( uniffi_suggest_checksum_method_suggeststore_fetch_provider_config ( ) != 37376 ) {
1439
+ return InitializationResult . apiChecksumMismatch
1440
+ }
1296
1441
if ( uniffi_suggest_checksum_method_suggeststore_ingest ( ) != 53781 ) {
1297
1442
return InitializationResult . apiChecksumMismatch
1298
1443
}
0 commit comments