@@ -281,7 +281,7 @@ private func makeRustCall<T, E: Swift.Error>(
281
281
_ callback: ( UnsafeMutablePointer < RustCallStatus > ) -> T ,
282
282
errorHandler: ( ( RustBuffer ) throws -> E ) ?
283
283
) throws -> T {
284
- uniffiEnsureAsOhttpClientInitialized ( )
284
+ uniffiEnsureInitialized ( )
285
285
var callStatus = RustCallStatus . init ( )
286
286
let returnedVal = callback ( & callStatus)
287
287
try uniffiCheckCallStatus ( callStatus: callStatus, errorHandler: errorHandler)
@@ -352,10 +352,9 @@ private func uniffiTraitInterfaceCallWithError<T, E>(
352
352
callStatus. pointee. errorBuf = FfiConverterString . lower ( String ( describing: error) )
353
353
}
354
354
}
355
- fileprivate final class UniffiHandleMap < T> : @unchecked Sendable {
356
- // All mutation happens with this lock held, which is why we implement @unchecked Sendable.
357
- private let lock = NSLock ( )
355
+ fileprivate class UniffiHandleMap < T> {
358
356
private var map : [ UInt64 : T ] = [ : ]
357
+ private let lock = NSLock ( )
359
358
private var currentHandle : UInt64 = 1
360
359
361
360
func insert( obj: T ) -> UInt64 {
@@ -393,7 +392,6 @@ fileprivate final class UniffiHandleMap<T>: @unchecked Sendable {
393
392
}
394
393
}
395
394
396
-
397
395
// Public interface members begin here.
398
396
399
397
@@ -477,7 +475,7 @@ fileprivate struct FfiConverterString: FfiConverter {
477
475
* Each OHTTP request-reply exchange needs to create an OhttpSession
478
476
* object to manage encryption state.
479
477
*/
480
- public protocol OhttpSessionProtocol : AnyObject {
478
+ public protocol OhttpSessionProtocol : AnyObject {
481
479
482
480
/**
483
481
* Decypt and unpack the response from the Relay for the previously
@@ -498,7 +496,8 @@ public protocol OhttpSessionProtocol: AnyObject {
498
496
* Each OHTTP request-reply exchange needs to create an OhttpSession
499
497
* object to manage encryption state.
500
498
*/
501
- open class OhttpSession : OhttpSessionProtocol , @unchecked Sendable {
499
+ open class OhttpSession :
500
+ OhttpSessionProtocol {
502
501
fileprivate let pointer : UnsafeMutableRawPointer !
503
502
504
503
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
@@ -539,7 +538,7 @@ open class OhttpSession: OhttpSessionProtocol, @unchecked Sendable {
539
538
*/
540
539
public convenience init ( config: [ UInt8 ] ) throws {
541
540
let pointer =
542
- try rustCallWithError ( FfiConverterTypeOhttpError_lift ) {
541
+ try rustCallWithError ( FfiConverterTypeOhttpError . lift ) {
543
542
uniffi_as_ohttp_client_fn_constructor_ohttpsession_new (
544
543
FfiConverterSequenceUInt8 . lower ( config) , $0
545
544
)
@@ -563,8 +562,8 @@ public convenience init(config: [UInt8])throws {
563
562
* encapsulated request. You must use the same OhttpSession that
564
563
* generated the request message.
565
564
*/
566
- open func decapsulate( encoded: [ UInt8 ] ) throws -> OhttpResponse {
567
- return try FfiConverterTypeOhttpResponse_lift ( try rustCallWithError ( FfiConverterTypeOhttpError_lift ) {
565
+ open func decapsulate( encoded: [ UInt8 ] ) throws -> OhttpResponse {
566
+ return try FfiConverterTypeOhttpResponse . lift ( try rustCallWithError ( FfiConverterTypeOhttpError . lift ) {
568
567
uniffi_as_ohttp_client_fn_method_ohttpsession_decapsulate ( self . uniffiClonePointer ( ) ,
569
568
FfiConverterSequenceUInt8 . lower ( encoded) , $0
570
569
)
@@ -576,8 +575,8 @@ open func decapsulate(encoded: [UInt8])throws -> OhttpResponse {
576
575
* payload using HPKE. The caller is responsible for sending the
577
576
* resulting message to the Relay.
578
577
*/
579
- open func encapsulate( method: String , scheme: String , server: String , endpoint: String , headers: [ String : String ] , payload: [ UInt8 ] ) throws -> [ UInt8 ] {
580
- return try FfiConverterSequenceUInt8 . lift ( try rustCallWithError ( FfiConverterTypeOhttpError_lift ) {
578
+ open func encapsulate( method: String , scheme: String , server: String , endpoint: String , headers: [ String : String ] , payload: [ UInt8 ] ) throws -> [ UInt8 ] {
579
+ return try FfiConverterSequenceUInt8 . lift ( try rustCallWithError ( FfiConverterTypeOhttpError . lift ) {
581
580
uniffi_as_ohttp_client_fn_method_ohttpsession_encapsulate ( self . uniffiClonePointer ( ) ,
582
581
FfiConverterString . lower ( method) ,
583
582
FfiConverterString . lower ( scheme) ,
@@ -592,7 +591,6 @@ open func encapsulate(method: String, scheme: String, server: String, endpoint:
592
591
593
592
}
594
593
595
-
596
594
#if swift(>=5.8)
597
595
@_documentation ( visibility: private)
598
596
#endif
@@ -628,6 +626,8 @@ public struct FfiConverterTypeOhttpSession: FfiConverter {
628
626
}
629
627
630
628
629
+
630
+
631
631
#if swift(>=5.8)
632
632
@_documentation ( visibility: private)
633
633
#endif
@@ -645,13 +645,11 @@ public func FfiConverterTypeOhttpSession_lower(_ value: OhttpSession) -> UnsafeM
645
645
646
646
647
647
648
-
649
-
650
648
/**
651
649
* A testing interface for decrypting and responding to OHTTP messages. This
652
650
* should only be used for testing.
653
651
*/
654
- public protocol OhttpTestServerProtocol : AnyObject {
652
+ public protocol OhttpTestServerProtocol : AnyObject {
655
653
656
654
/**
657
655
* Return the unique encryption key config for this instance of test server.
@@ -667,7 +665,8 @@ public protocol OhttpTestServerProtocol: AnyObject {
667
665
* A testing interface for decrypting and responding to OHTTP messages. This
668
666
* should only be used for testing.
669
667
*/
670
- open class OhttpTestServer : OhttpTestServerProtocol , @unchecked Sendable {
668
+ open class OhttpTestServer :
669
+ OhttpTestServerProtocol {
671
670
fileprivate let pointer : UnsafeMutableRawPointer !
672
671
673
672
/// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly.
@@ -726,33 +725,32 @@ public convenience init() {
726
725
/**
727
726
* Return the unique encryption key config for this instance of test server.
728
727
*/
729
- open func getConfig( ) -> [ UInt8 ] {
728
+ open func getConfig( ) -> [ UInt8 ] {
730
729
return try ! FfiConverterSequenceUInt8 . lift ( try ! rustCall ( ) {
731
730
uniffi_as_ohttp_client_fn_method_ohttptestserver_get_config ( self . uniffiClonePointer ( ) , $0
732
731
)
733
732
} )
734
733
}
735
734
736
- open func receive( message: [ UInt8 ] ) throws -> TestServerRequest {
737
- return try FfiConverterTypeTestServerRequest_lift ( try rustCallWithError ( FfiConverterTypeOhttpError_lift ) {
735
+ open func receive( message: [ UInt8 ] ) throws -> TestServerRequest {
736
+ return try FfiConverterTypeTestServerRequest . lift ( try rustCallWithError ( FfiConverterTypeOhttpError . lift ) {
738
737
uniffi_as_ohttp_client_fn_method_ohttptestserver_receive ( self . uniffiClonePointer ( ) ,
739
738
FfiConverterSequenceUInt8 . lower ( message) , $0
740
739
)
741
740
} )
742
741
}
743
742
744
- open func respond( response: OhttpResponse ) throws -> [ UInt8 ] {
745
- return try FfiConverterSequenceUInt8 . lift ( try rustCallWithError ( FfiConverterTypeOhttpError_lift ) {
743
+ open func respond( response: OhttpResponse ) throws -> [ UInt8 ] {
744
+ return try FfiConverterSequenceUInt8 . lift ( try rustCallWithError ( FfiConverterTypeOhttpError . lift ) {
746
745
uniffi_as_ohttp_client_fn_method_ohttptestserver_respond ( self . uniffiClonePointer ( ) ,
747
- FfiConverterTypeOhttpResponse_lower ( response) , $0
746
+ FfiConverterTypeOhttpResponse . lower ( response) , $0
748
747
)
749
748
} )
750
749
}
751
750
752
751
753
752
}
754
753
755
-
756
754
#if swift(>=5.8)
757
755
@_documentation ( visibility: private)
758
756
#endif
@@ -788,6 +786,8 @@ public struct FfiConverterTypeOhttpTestServer: FfiConverter {
788
786
}
789
787
790
788
789
+
790
+
791
791
#if swift(>=5.8)
792
792
@_documentation ( visibility: private)
793
793
#endif
@@ -803,8 +803,6 @@ public func FfiConverterTypeOhttpTestServer_lower(_ value: OhttpTestServer) -> U
803
803
}
804
804
805
805
806
-
807
-
808
806
/**
809
807
* The decrypted response from the Gateway/Target
810
808
*/
@@ -822,9 +820,6 @@ public struct OhttpResponse {
822
820
}
823
821
}
824
822
825
- #if compiler(>=6)
826
- extension OhttpResponse : Sendable { }
827
- #endif
828
823
829
824
830
825
extension OhttpResponse : Equatable , Hashable {
@@ -849,7 +844,6 @@ extension OhttpResponse: Equatable, Hashable {
849
844
}
850
845
851
846
852
-
853
847
#if swift(>=5.8)
854
848
@_documentation ( visibility: private)
855
849
#endif
@@ -906,9 +900,6 @@ public struct TestServerRequest {
906
900
}
907
901
}
908
902
909
- #if compiler(>=6)
910
- extension TestServerRequest : Sendable { }
911
- #endif
912
903
913
904
914
905
extension TestServerRequest : Equatable , Hashable {
@@ -945,7 +936,6 @@ extension TestServerRequest: Equatable, Hashable {
945
936
}
946
937
947
938
948
-
949
939
#if swift(>=5.8)
950
940
@_documentation ( visibility: private)
951
941
#endif
@@ -1090,32 +1080,14 @@ public struct FfiConverterTypeOhttpError: FfiConverterRustBuffer {
1090
1080
}
1091
1081
1092
1082
1093
- #if swift(>=5.8)
1094
- @_documentation ( visibility: private)
1095
- #endif
1096
- public func FfiConverterTypeOhttpError_lift( _ buf: RustBuffer ) throws -> OhttpError {
1097
- return try FfiConverterTypeOhttpError . lift ( buf)
1098
- }
1099
-
1100
- #if swift(>=5.8)
1101
- @_documentation ( visibility: private)
1102
- #endif
1103
- public func FfiConverterTypeOhttpError_lower( _ value: OhttpError ) -> RustBuffer {
1104
- return FfiConverterTypeOhttpError . lower ( value)
1105
- }
1106
-
1107
-
1108
1083
extension OhttpError : Equatable , Hashable { }
1109
1084
1110
-
1111
-
1112
1085
extension OhttpError : Foundation . LocalizedError {
1113
1086
public var errorDescription : String ? {
1114
1087
String ( reflecting: self )
1115
1088
}
1116
1089
}
1117
1090
1118
-
1119
1091
#if swift(>=5.8)
1120
1092
@_documentation ( visibility: private)
1121
1093
#endif
@@ -1174,9 +1146,9 @@ private enum InitializationResult {
1174
1146
}
1175
1147
// Use a global variable to perform the versioning checks. Swift ensures that
1176
1148
// the code inside is only computed once.
1177
- private let initializationResult : InitializationResult = {
1149
+ private var initializationResult : InitializationResult = {
1178
1150
// Get the bindings contract version from our ComponentInterface
1179
- let bindings_contract_version = 29
1151
+ let bindings_contract_version = 26
1180
1152
// Get the scaffolding contract version by calling the into the dylib
1181
1153
let scaffolding_contract_version = ffi_as_ohttp_client_uniffi_contract_version ( )
1182
1154
if bindings_contract_version != scaffolding_contract_version {
@@ -1197,19 +1169,17 @@ private let initializationResult: InitializationResult = {
1197
1169
if ( uniffi_as_ohttp_client_checksum_method_ohttptestserver_respond ( ) != 21845 ) {
1198
1170
return InitializationResult . apiChecksumMismatch
1199
1171
}
1200
- if ( uniffi_as_ohttp_client_checksum_constructor_ohttpsession_new ( ) != 12377 ) {
1172
+ if ( uniffi_as_ohttp_client_checksum_constructor_ohttpsession_new ( ) != 63666 ) {
1201
1173
return InitializationResult . apiChecksumMismatch
1202
1174
}
1203
- if ( uniffi_as_ohttp_client_checksum_constructor_ohttptestserver_new ( ) != 10284 ) {
1175
+ if ( uniffi_as_ohttp_client_checksum_constructor_ohttptestserver_new ( ) != 42944 ) {
1204
1176
return InitializationResult . apiChecksumMismatch
1205
1177
}
1206
1178
1207
1179
return InitializationResult . ok
1208
1180
} ( )
1209
1181
1210
- // Make the ensure init function public so that other modules which have external type references to
1211
- // our types can call it.
1212
- public func uniffiEnsureAsOhttpClientInitialized( ) {
1182
+ private func uniffiEnsureInitialized( ) {
1213
1183
switch initializationResult {
1214
1184
case . ok:
1215
1185
break
0 commit comments