Update hublib ios
This commit is contained in:
@@ -170,10 +170,16 @@ fileprivate protocol FfiConverter {
|
||||
fileprivate protocol FfiConverterPrimitive: FfiConverter where FfiType == SwiftType { }
|
||||
|
||||
extension FfiConverterPrimitive {
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public static func lift(_ value: FfiType) throws -> SwiftType {
|
||||
return value
|
||||
}
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public static func lower(_ value: SwiftType) -> FfiType {
|
||||
return value
|
||||
}
|
||||
@@ -184,6 +190,9 @@ extension FfiConverterPrimitive {
|
||||
fileprivate protocol FfiConverterRustBuffer: FfiConverter where FfiType == RustBuffer {}
|
||||
|
||||
extension FfiConverterRustBuffer {
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public static func lift(_ buf: RustBuffer) throws -> SwiftType {
|
||||
var reader = createReader(data: Data(rustBuffer: buf))
|
||||
let value = try read(from: &reader)
|
||||
@@ -194,6 +203,9 @@ extension FfiConverterRustBuffer {
|
||||
return value
|
||||
}
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
public static func lower(_ value: SwiftType) -> RustBuffer {
|
||||
var writer = createWriter()
|
||||
write(value, into: &writer)
|
||||
@@ -269,7 +281,7 @@ private func makeRustCall<T, E: Swift.Error>(
|
||||
_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T,
|
||||
errorHandler: ((RustBuffer) throws -> E)?
|
||||
) throws -> T {
|
||||
uniffiEnsureInitialized()
|
||||
uniffiEnsureHublibInitialized()
|
||||
var callStatus = RustCallStatus.init()
|
||||
let returnedVal = callback(&callStatus)
|
||||
try uniffiCheckCallStatus(callStatus: callStatus, errorHandler: errorHandler)
|
||||
@@ -340,9 +352,10 @@ private func uniffiTraitInterfaceCallWithError<T, E>(
|
||||
callStatus.pointee.errorBuf = FfiConverterString.lower(String(describing: error))
|
||||
}
|
||||
}
|
||||
fileprivate class UniffiHandleMap<T> {
|
||||
private var map: [UInt64: T] = [:]
|
||||
fileprivate final class UniffiHandleMap<T>: @unchecked Sendable {
|
||||
// All mutation happens with this lock held, which is why we implement @unchecked Sendable.
|
||||
private let lock = NSLock()
|
||||
private var map: [UInt64: T] = [:]
|
||||
private var currentHandle: UInt64 = 1
|
||||
|
||||
func insert(obj: T) -> UInt64 {
|
||||
@@ -384,6 +397,9 @@ fileprivate class UniffiHandleMap<T> {
|
||||
// Public interface members begin here.
|
||||
|
||||
|
||||
#if swift(>=5.8)
|
||||
@_documentation(visibility: private)
|
||||
#endif
|
||||
fileprivate struct FfiConverterString: FfiConverter {
|
||||
typealias SwiftType = String
|
||||
typealias FfiType = RustBuffer
|
||||
@@ -421,7 +437,7 @@ fileprivate struct FfiConverterString: FfiConverter {
|
||||
writeBytes(&buf, value.utf8)
|
||||
}
|
||||
}
|
||||
public func getSecretValue(httpTime: String, userAgent: String, url: String) -> String {
|
||||
public func getSecretValue(httpTime: String, userAgent: String, url: String) -> String {
|
||||
return try! FfiConverterString.lift(try! rustCall() {
|
||||
uniffi_hublib_fn_func_get_secret_value(
|
||||
FfiConverterString.lower(httpTime),
|
||||
@@ -430,7 +446,7 @@ public func getSecretValue(httpTime: String, userAgent: String, url: String) ->
|
||||
)
|
||||
})
|
||||
}
|
||||
public func recreateSecretValue(httpDate: String, userAgent: String, url: String, gottenValue: String) -> String {
|
||||
public func recreateSecretValue(httpDate: String, userAgent: String, url: String, gottenValue: String) -> String {
|
||||
return try! FfiConverterString.lift(try! rustCall() {
|
||||
uniffi_hublib_fn_func_recreate_secret_value(
|
||||
FfiConverterString.lower(httpDate),
|
||||
@@ -448,9 +464,9 @@ private enum InitializationResult {
|
||||
}
|
||||
// Use a global variable to perform the versioning checks. Swift ensures that
|
||||
// the code inside is only computed once.
|
||||
private var initializationResult: InitializationResult = {
|
||||
private let initializationResult: InitializationResult = {
|
||||
// Get the bindings contract version from our ComponentInterface
|
||||
let bindings_contract_version = 26
|
||||
let bindings_contract_version = 29
|
||||
// Get the scaffolding contract version by calling the into the dylib
|
||||
let scaffolding_contract_version = ffi_hublib_uniffi_contract_version()
|
||||
if bindings_contract_version != scaffolding_contract_version {
|
||||
@@ -466,7 +482,9 @@ private var initializationResult: InitializationResult = {
|
||||
return InitializationResult.ok
|
||||
}()
|
||||
|
||||
private func uniffiEnsureInitialized() {
|
||||
// Make the ensure init function public so that other modules which have external type references to
|
||||
// our types can call it.
|
||||
public func uniffiEnsureHublibInitialized() {
|
||||
switch initializationResult {
|
||||
case .ok:
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user