@@ -534,6 +534,125 @@ public func FfiConverterTypeSuggestStore_lower(_ value: SuggestStore) -> UnsafeM
534
534
}
535
535
536
536
537
+ public protocol SuggestStoreBuilderProtocol {
538
+ func build( ) throws -> SuggestStore
539
+ func cachePath( path: String ) -> SuggestStoreBuilder
540
+ func dataPath( path: String ) -> SuggestStoreBuilder
541
+ func remoteSettingsConfig( config: RemoteSettingsConfig ) -> SuggestStoreBuilder
542
+
543
+ }
544
+
545
+ public class SuggestStoreBuilder : SuggestStoreBuilderProtocol {
546
+ fileprivate let pointer : UnsafeMutableRawPointer
547
+
548
+ // TODO: We'd like this to be `private` but for Swifty reasons,
549
+ // we can't implement `FfiConverter` without making this `required` and we can't
550
+ // make it `required` without making it `public`.
551
+ required init ( unsafeFromRawPointer pointer: UnsafeMutableRawPointer ) {
552
+ self . pointer = pointer
553
+ }
554
+ public convenience init ( ) {
555
+ self . init ( unsafeFromRawPointer: try ! rustCall ( ) {
556
+ uniffi_suggest_fn_constructor_suggeststorebuilder_new ( $0)
557
+ } )
558
+ }
559
+
560
+ deinit {
561
+ try ! rustCall { uniffi_suggest_fn_free_suggeststorebuilder ( pointer, $0) }
562
+ }
563
+
564
+
565
+
566
+
567
+
568
+
569
+ public func build( ) throws -> SuggestStore {
570
+ return try FfiConverterTypeSuggestStore . lift (
571
+ try
572
+ rustCallWithError ( FfiConverterTypeSuggestApiError . lift) {
573
+ uniffi_suggest_fn_method_suggeststorebuilder_build ( self . pointer, $0
574
+ )
575
+ }
576
+ )
577
+ }
578
+
579
+ public func cachePath( path: String ) -> SuggestStoreBuilder {
580
+ return try ! FfiConverterTypeSuggestStoreBuilder . lift (
581
+ try !
582
+ rustCall ( ) {
583
+
584
+ uniffi_suggest_fn_method_suggeststorebuilder_cache_path ( self . pointer,
585
+ FfiConverterString . lower ( path) , $0
586
+ )
587
+ }
588
+ )
589
+ }
590
+
591
+ public func dataPath( path: String ) -> SuggestStoreBuilder {
592
+ return try ! FfiConverterTypeSuggestStoreBuilder . lift (
593
+ try !
594
+ rustCall ( ) {
595
+
596
+ uniffi_suggest_fn_method_suggeststorebuilder_data_path ( self . pointer,
597
+ FfiConverterString . lower ( path) , $0
598
+ )
599
+ }
600
+ )
601
+ }
602
+
603
+ public func remoteSettingsConfig( config: RemoteSettingsConfig ) -> SuggestStoreBuilder {
604
+ return try ! FfiConverterTypeSuggestStoreBuilder . lift (
605
+ try !
606
+ rustCall ( ) {
607
+
608
+ uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_config ( self . pointer,
609
+ FfiConverterTypeRemoteSettingsConfig_lower ( config) , $0
610
+ )
611
+ }
612
+ )
613
+ }
614
+ }
615
+
616
+ public struct FfiConverterTypeSuggestStoreBuilder : FfiConverter {
617
+ typealias FfiType = UnsafeMutableRawPointer
618
+ typealias SwiftType = SuggestStoreBuilder
619
+
620
+ public static func read( from buf: inout ( data: Data , offset: Data . Index ) ) throws -> SuggestStoreBuilder {
621
+ let v : UInt64 = try readInt ( & buf)
622
+ // The Rust code won't compile if a pointer won't fit in a UInt64.
623
+ // We have to go via `UInt` because that's the thing that's the size of a pointer.
624
+ let ptr = UnsafeMutableRawPointer ( bitPattern: UInt ( truncatingIfNeeded: v) )
625
+ if ( ptr == nil ) {
626
+ throw UniffiInternalError . unexpectedNullPointer
627
+ }
628
+ return try lift ( ptr!)
629
+ }
630
+
631
+ public static func write( _ value: SuggestStoreBuilder , into buf: inout [ UInt8 ] ) {
632
+ // This fiddling is because `Int` is the thing that's the same size as a pointer.
633
+ // The Rust code won't compile if a pointer won't fit in a `UInt64`.
634
+ writeInt ( & buf, UInt64 ( bitPattern: Int64 ( Int ( bitPattern: lower ( value) ) ) ) )
635
+ }
636
+
637
+ public static func lift( _ pointer: UnsafeMutableRawPointer ) throws -> SuggestStoreBuilder {
638
+ return SuggestStoreBuilder ( unsafeFromRawPointer: pointer)
639
+ }
640
+
641
+ public static func lower( _ value: SuggestStoreBuilder ) -> UnsafeMutableRawPointer {
642
+ return value. pointer
643
+ }
644
+ }
645
+
646
+
647
+ public func FfiConverterTypeSuggestStoreBuilder_lift( _ pointer: UnsafeMutableRawPointer ) throws -> SuggestStoreBuilder {
648
+ return try FfiConverterTypeSuggestStoreBuilder . lift ( pointer)
649
+ }
650
+
651
+ public func FfiConverterTypeSuggestStoreBuilder_lower( _ value: SuggestStoreBuilder ) -> UnsafeMutableRawPointer {
652
+ return FfiConverterTypeSuggestStoreBuilder . lower ( value)
653
+ }
654
+
655
+
537
656
public struct SuggestIngestionConstraints {
538
657
public var maxSuggestions : UInt64 ?
539
658
@@ -725,7 +844,7 @@ public enum Suggestion {
725
844
case pocket( title: String , url: String , score: Double , isTopPick: Bool )
726
845
case wikipedia( title: String , url: String , icon: [ UInt8 ] ? , fullKeyword: String )
727
846
case amo( title: String , url: String , iconUrl: String , description: String , rating: String ? , numberOfRatings: Int64 , guid: String , score: Double )
728
- case yelp( url: String , title: String )
847
+ case yelp( url: String , title: String , isTopPick : Bool )
729
848
case mdn( title: String , url: String , description: String , score: Double )
730
849
case weather( score: Double )
731
850
}
@@ -779,7 +898,8 @@ public struct FfiConverterTypeSuggestion: FfiConverterRustBuffer {
779
898
780
899
case 5 : return . yelp(
781
900
url: try FfiConverterString . read ( from: & buf) ,
782
- title: try FfiConverterString . read ( from: & buf)
901
+ title: try FfiConverterString . read ( from: & buf) ,
902
+ isTopPick: try FfiConverterBool . read ( from: & buf)
783
903
)
784
904
785
905
case 6 : return . mdn(
@@ -845,10 +965,11 @@ public struct FfiConverterTypeSuggestion: FfiConverterRustBuffer {
845
965
FfiConverterDouble . write ( score, into: & buf)
846
966
847
967
848
- case let . yelp( url, title) :
968
+ case let . yelp( url, title, isTopPick ) :
849
969
writeInt ( & buf, Int32 ( 5 ) )
850
970
FfiConverterString . write ( url, into: & buf)
851
971
FfiConverterString . write ( title, into: & buf)
972
+ FfiConverterBool . write ( isTopPick, into: & buf)
852
973
853
974
854
975
case let . mdn( title, url, description, score) :
@@ -1181,9 +1302,24 @@ private var initializationResult: InitializationResult {
1181
1302
if ( uniffi_suggest_checksum_method_suggeststore_query ( ) != 22367 ) {
1182
1303
return InitializationResult . apiChecksumMismatch
1183
1304
}
1305
+ if ( uniffi_suggest_checksum_method_suggeststorebuilder_build ( ) != 32624 ) {
1306
+ return InitializationResult . apiChecksumMismatch
1307
+ }
1308
+ if ( uniffi_suggest_checksum_method_suggeststorebuilder_cache_path ( ) != 30962 ) {
1309
+ return InitializationResult . apiChecksumMismatch
1310
+ }
1311
+ if ( uniffi_suggest_checksum_method_suggeststorebuilder_data_path ( ) != 50155 ) {
1312
+ return InitializationResult . apiChecksumMismatch
1313
+ }
1314
+ if ( uniffi_suggest_checksum_method_suggeststorebuilder_remote_settings_config ( ) != 34189 ) {
1315
+ return InitializationResult . apiChecksumMismatch
1316
+ }
1184
1317
if ( uniffi_suggest_checksum_constructor_suggeststore_new ( ) != 38439 ) {
1185
1318
return InitializationResult . apiChecksumMismatch
1186
1319
}
1320
+ if ( uniffi_suggest_checksum_constructor_suggeststorebuilder_new ( ) != 26099 ) {
1321
+ return InitializationResult . apiChecksumMismatch
1322
+ }
1187
1323
1188
1324
return InitializationResult . ok
1189
1325
}
0 commit comments