@npaw/forge-react-native 9.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/LICENSE +10 -0
  2. package/NPAWForgeReactNative.podspec +44 -0
  3. package/README.md +51 -0
  4. package/android/build.gradle +77 -0
  5. package/android/src/main/AndroidManifest.xml +14 -0
  6. package/android/src/main/java/com/npaw/forge/reactnative/ForgeDtoMapper.java +295 -0
  7. package/android/src/main/java/com/npaw/forge/reactnative/ForgeInstanceRegistry.java +61 -0
  8. package/android/src/main/java/com/npaw/forge/reactnative/NPAWForgeModule.java +735 -0
  9. package/android/src/main/java/com/npaw/forge/reactnative/NPAWForgePackage.java +53 -0
  10. package/android/src/test/java/com/npaw/forge/reactnative/ForgeDtoMapperTest.java +133 -0
  11. package/ios/ForgeApple/ForgeKernelFFI.xcframework/Info.plist +82 -0
  12. package/ios/ForgeApple/ForgeKernelFFI.xcframework/ios-arm64/Headers/ForgeKernelFFI.h +17 -0
  13. package/ios/ForgeApple/ForgeKernelFFI.xcframework/ios-arm64/Headers/forge_kernelFFI.h +873 -0
  14. package/ios/ForgeApple/ForgeKernelFFI.xcframework/ios-arm64/Headers/module.modulemap +7 -0
  15. package/ios/ForgeApple/ForgeKernelFFI.xcframework/ios-arm64/libForgeKernelFFI.a +0 -0
  16. package/ios/ForgeApple/ForgeKernelFFI.xcframework/ios-arm64_x86_64-simulator/Headers/ForgeKernelFFI.h +17 -0
  17. package/ios/ForgeApple/ForgeKernelFFI.xcframework/ios-arm64_x86_64-simulator/Headers/forge_kernelFFI.h +873 -0
  18. package/ios/ForgeApple/ForgeKernelFFI.xcframework/ios-arm64_x86_64-simulator/Headers/module.modulemap +7 -0
  19. package/ios/ForgeApple/ForgeKernelFFI.xcframework/ios-arm64_x86_64-simulator/libForgeKernelFFI.a +0 -0
  20. package/ios/ForgeApple/ForgeKernelFFI.xcframework/tvos-arm64/Headers/ForgeKernelFFI.h +17 -0
  21. package/ios/ForgeApple/ForgeKernelFFI.xcframework/tvos-arm64/Headers/forge_kernelFFI.h +873 -0
  22. package/ios/ForgeApple/ForgeKernelFFI.xcframework/tvos-arm64/Headers/module.modulemap +7 -0
  23. package/ios/ForgeApple/ForgeKernelFFI.xcframework/tvos-arm64/libForgeKernelFFI.a +0 -0
  24. package/ios/ForgeApple/ForgeKernelFFI.xcframework/tvos-arm64-simulator/Headers/ForgeKernelFFI.h +17 -0
  25. package/ios/ForgeApple/ForgeKernelFFI.xcframework/tvos-arm64-simulator/Headers/forge_kernelFFI.h +873 -0
  26. package/ios/ForgeApple/ForgeKernelFFI.xcframework/tvos-arm64-simulator/Headers/module.modulemap +7 -0
  27. package/ios/ForgeApple/ForgeKernelFFI.xcframework/tvos-arm64-simulator/libForgeKernelFFI.a +0 -0
  28. package/ios/ForgeApple/Sources/ForgeKernelUniFFI/forge_kernel.swift +3931 -0
  29. package/ios/ForgeApple/Sources/ForgeKernelUniFFI/forge_kernelFFI.h +873 -0
  30. package/ios/ForgeApple/Sources/ForgeKernelUniFFI/forge_kernelFFI.modulemap +7 -0
  31. package/ios/ForgeApple/Sources/NPAWForgeAVPlayerAdapter/AVPlayerAccessLogFacts.swift +152 -0
  32. package/ios/ForgeApple/Sources/NPAWForgeAVPlayerAdapter/AVPlayerAdapter.swift +877 -0
  33. package/ios/ForgeApple/Sources/NPAWForgeCapture/AttributionCapture.swift +158 -0
  34. package/ios/ForgeApple/Sources/NPAWForgeCapture/CapturePlanGate.swift +189 -0
  35. package/ios/ForgeApple/Sources/NPAWForgeCapture/CrashCapture.swift +120 -0
  36. package/ios/ForgeApple/Sources/NPAWForgeCapture/ForgeAutomaticCapture.swift +639 -0
  37. package/ios/ForgeApple/Sources/NPAWForgeCapture/SectionsCapture.swift +1176 -0
  38. package/ios/ForgeApple/Sources/NPAWForgeCapture/SectionsEngine.swift +674 -0
  39. package/ios/ForgeApple/Sources/NPAWForgeCapture/SectionsMarkers.swift +105 -0
  40. package/ios/ForgeApple/Sources/NPAWForgeCapture/SectionsSwiftUI.swift +284 -0
  41. package/ios/ForgeApple/Sources/NPAWForgeCapture/SwiftUICapture.swift +44 -0
  42. package/ios/ForgeApple/Sources/NPAWForgeCore/AdAdapter.swift +199 -0
  43. package/ios/ForgeApple/Sources/NPAWForgeCore/AdSemantics.swift +136 -0
  44. package/ios/ForgeApple/Sources/NPAWForgeCore/ForgeApple.swift +596 -0
  45. package/ios/ForgeApple/Sources/NPAWForgeCore/ForgeCapturePlan.swift +297 -0
  46. package/ios/ForgeApple/Sources/NPAWForgeCore/ForgeClock.swift +29 -0
  47. package/ios/ForgeApple/Sources/NPAWForgeCore/ForgeLogging.swift +109 -0
  48. package/ios/ForgeApple/Sources/NPAWForgeCore/ForgeOutcome.swift +89 -0
  49. package/ios/ForgeApple/Sources/NPAWForgeCore/ForgeRuntime.swift +291 -0
  50. package/ios/ForgeApple/Sources/NPAWForgeCore/ForgeStorage.swift +70 -0
  51. package/ios/ForgeApple/Sources/NPAWForgeCore/ManualAdReporter.swift +180 -0
  52. package/ios/ForgeApple/Sources/NPAWForgeCore/NPAWForge.swift +453 -0
  53. package/ios/ForgeApple/Sources/NPAWForgeCore/NativeUniFFIRuntime.swift +594 -0
  54. package/ios/ForgeApple/Sources/NPAWForgeCore/NetworkRequestRecord.swift +191 -0
  55. package/ios/ForgeApple/Sources/NPAWForgeCore/ObjectiveCWrappers.swift +191 -0
  56. package/ios/ForgeApple/Sources/NPAWForgeCore/PlayerAdapter.swift +299 -0
  57. package/ios/ForgeApple/Sources/NPAWForgeCore/PlayerSemantics.swift +266 -0
  58. package/ios/ForgeApple/Sources/NPAWForgeCore/PrivacySanitizer.swift +59 -0
  59. package/ios/ForgeApple/Sources/NPAWForgeCore/VideoAdapter.swift +478 -0
  60. package/ios/ForgeApple/Sources/NPAWForgeCore/VideoOptions.swift +431 -0
  61. package/ios/ForgeApple/Sources/NPAWForgeNetworkCapture/ForgeNetworkCapture.swift +116 -0
  62. package/ios/ForgeApple/Sources/NPAWForgeNetworkCaptureObjC/NPAWForgeNetworkSwizzler.m +293 -0
  63. package/ios/ForgeApple/Sources/NPAWForgeNetworkCaptureObjC/include/NPAWForgeNetworkSwizzler.h +33 -0
  64. package/ios/ForgeModuleImpl.swift +1131 -0
  65. package/ios/NPAWForgeTurboModule.mm +399 -0
  66. package/package.json +33 -0
  67. package/src/ForgeAdReporter.ts +101 -0
  68. package/src/ForgeVideo.ts +169 -0
  69. package/src/NPAWForge.ts +177 -0
  70. package/src/capture.ts +192 -0
  71. package/src/events.ts +40 -0
  72. package/src/index.ts +37 -0
  73. package/src/specs/NativeNPAWForge.ts +168 -0
  74. package/src/types.ts +114 -0
@@ -0,0 +1,3931 @@
1
+ /**
2
+ * Copyright (C) NPAW - All Rights Reserved
3
+ *
4
+ * This source code is protected under international copyright law. All rights
5
+ * reserved and protected by the copyright holders.
6
+ * This file is confidential and only available to authorized individuals with the
7
+ * permission of the copyright holders. If you encounter this file and do not have
8
+ * permission, please contact the copyright holders and delete this file.
9
+ *
10
+ *
11
+ * @author: Victor Soto <victor.soto@nicepeopleatwork.com>
12
+ * @description: Generated Swift UniFFI bridge for the Forge Apple runtime binding.
13
+ */
14
+
15
+ // swiftlint:disable all
16
+ import Foundation
17
+
18
+ // Depending on the consumer's build setup, the low-level FFI code
19
+ // might be in a separate module, or it might be compiled inline into
20
+ // this module. This is a bit of light hackery to work with both.
21
+ #if canImport(ForgeKernelFFI)
22
+ import ForgeKernelFFI
23
+ #endif
24
+
25
+ fileprivate extension RustBuffer {
26
+ // Allocate a new buffer, copying the contents of a `UInt8` array.
27
+ init(bytes: [UInt8]) {
28
+ let rbuf = bytes.withUnsafeBufferPointer { ptr in
29
+ RustBuffer.from(ptr)
30
+ }
31
+ self.init(capacity: rbuf.capacity, len: rbuf.len, data: rbuf.data)
32
+ }
33
+
34
+ static func empty() -> RustBuffer {
35
+ RustBuffer(capacity: 0, len:0, data: nil)
36
+ }
37
+
38
+ static func from(_ ptr: UnsafeBufferPointer<UInt8>) -> RustBuffer {
39
+ try! rustCall { ffi_forge_kernel_uniffi_rustbuffer_from_bytes(ForeignBytes(bufferPointer: ptr), $0) }
40
+ }
41
+
42
+ // Frees the buffer in place.
43
+ // The buffer must not be used after this is called.
44
+ func deallocate() {
45
+ try! rustCall { ffi_forge_kernel_uniffi_rustbuffer_free(self, $0) }
46
+ }
47
+ }
48
+
49
+ fileprivate extension ForeignBytes {
50
+ init(bufferPointer: UnsafeBufferPointer<UInt8>) {
51
+ self.init(len: Int32(bufferPointer.count), data: bufferPointer.baseAddress)
52
+ }
53
+ }
54
+
55
+ // For every type used in the interface, we provide helper methods for conveniently
56
+ // lifting and lowering that type from C-compatible data, and for reading and writing
57
+ // values of that type in a buffer.
58
+
59
+ // Helper classes/extensions that don't change.
60
+ // Someday, this will be in a library of its own.
61
+
62
+ fileprivate extension Data {
63
+ init(rustBuffer: RustBuffer) {
64
+ self.init(
65
+ bytesNoCopy: rustBuffer.data!,
66
+ count: Int(rustBuffer.len),
67
+ deallocator: .none
68
+ )
69
+ }
70
+ }
71
+
72
+ // Define reader functionality. Normally this would be defined in a class or
73
+ // struct, but we use standalone functions instead in order to make external
74
+ // types work.
75
+ //
76
+ // With external types, one swift source file needs to be able to call the read
77
+ // method on another source file's FfiConverter, but then what visibility
78
+ // should Reader have?
79
+ // - If Reader is fileprivate, then this means the read() must also
80
+ // be fileprivate, which doesn't work with external types.
81
+ // - If Reader is internal/public, we'll get compile errors since both source
82
+ // files will try define the same type.
83
+ //
84
+ // Instead, the read() method and these helper functions input a tuple of data
85
+
86
+ fileprivate func createReader(data: Data) -> (data: Data, offset: Data.Index) {
87
+ (data: data, offset: 0)
88
+ }
89
+
90
+ // Reads an integer at the current offset, in big-endian order, and advances
91
+ // the offset on success. Throws if reading the integer would move the
92
+ // offset past the end of the buffer.
93
+ fileprivate func readInt<T: FixedWidthInteger>(_ reader: inout (data: Data, offset: Data.Index)) throws -> T {
94
+ let range = reader.offset..<reader.offset + MemoryLayout<T>.size
95
+ guard reader.data.count >= range.upperBound else {
96
+ throw UniffiInternalError.bufferOverflow
97
+ }
98
+ if T.self == UInt8.self {
99
+ let value = reader.data[reader.offset]
100
+ reader.offset += 1
101
+ return value as! T
102
+ }
103
+ var value: T = 0
104
+ let _ = withUnsafeMutableBytes(of: &value, { reader.data.copyBytes(to: $0, from: range)})
105
+ reader.offset = range.upperBound
106
+ return value.bigEndian
107
+ }
108
+
109
+ // Reads an arbitrary number of bytes, to be used to read
110
+ // raw bytes, this is useful when lifting strings
111
+ fileprivate func readBytes(_ reader: inout (data: Data, offset: Data.Index), count: Int) throws -> Array<UInt8> {
112
+ let range = reader.offset..<(reader.offset+count)
113
+ guard reader.data.count >= range.upperBound else {
114
+ throw UniffiInternalError.bufferOverflow
115
+ }
116
+ var value = [UInt8](repeating: 0, count: count)
117
+ value.withUnsafeMutableBufferPointer({ buffer in
118
+ reader.data.copyBytes(to: buffer, from: range)
119
+ })
120
+ reader.offset = range.upperBound
121
+ return value
122
+ }
123
+
124
+ // Reads a float at the current offset.
125
+ fileprivate func readFloat(_ reader: inout (data: Data, offset: Data.Index)) throws -> Float {
126
+ return Float(bitPattern: try readInt(&reader))
127
+ }
128
+
129
+ // Reads a float at the current offset.
130
+ fileprivate func readDouble(_ reader: inout (data: Data, offset: Data.Index)) throws -> Double {
131
+ return Double(bitPattern: try readInt(&reader))
132
+ }
133
+
134
+ // Indicates if the offset has reached the end of the buffer.
135
+ fileprivate func hasRemaining(_ reader: (data: Data, offset: Data.Index)) -> Bool {
136
+ return reader.offset < reader.data.count
137
+ }
138
+
139
+ // Define writer functionality. Normally this would be defined in a class or
140
+ // struct, but we use standalone functions instead in order to make external
141
+ // types work. See the above discussion on Readers for details.
142
+
143
+ fileprivate func createWriter() -> [UInt8] {
144
+ return []
145
+ }
146
+
147
+ fileprivate func writeBytes<S>(_ writer: inout [UInt8], _ byteArr: S) where S: Sequence, S.Element == UInt8 {
148
+ writer.append(contentsOf: byteArr)
149
+ }
150
+
151
+ // Writes an integer in big-endian order.
152
+ //
153
+ // Warning: make sure what you are trying to write
154
+ // is in the correct type!
155
+ fileprivate func writeInt<T: FixedWidthInteger>(_ writer: inout [UInt8], _ value: T) {
156
+ var value = value.bigEndian
157
+ withUnsafeBytes(of: &value) { writer.append(contentsOf: $0) }
158
+ }
159
+
160
+ fileprivate func writeFloat(_ writer: inout [UInt8], _ value: Float) {
161
+ writeInt(&writer, value.bitPattern)
162
+ }
163
+
164
+ fileprivate func writeDouble(_ writer: inout [UInt8], _ value: Double) {
165
+ writeInt(&writer, value.bitPattern)
166
+ }
167
+
168
+ // Protocol for types that transfer other types across the FFI. This is
169
+ // analogous to the Rust trait of the same name.
170
+ fileprivate protocol FfiConverter {
171
+ associatedtype FfiType
172
+ associatedtype SwiftType
173
+
174
+ static func lift(_ value: FfiType) throws -> SwiftType
175
+ static func lower(_ value: SwiftType) -> FfiType
176
+ static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType
177
+ static func write(_ value: SwiftType, into buf: inout [UInt8])
178
+ }
179
+
180
+ // Types conforming to `Primitive` pass themselves directly over the FFI.
181
+ fileprivate protocol FfiConverterPrimitive: FfiConverter where FfiType == SwiftType { }
182
+
183
+ extension FfiConverterPrimitive {
184
+ #if swift(>=5.8)
185
+ @_documentation(visibility: private)
186
+ #endif
187
+ public static func lift(_ value: FfiType) throws -> SwiftType {
188
+ return value
189
+ }
190
+
191
+ #if swift(>=5.8)
192
+ @_documentation(visibility: private)
193
+ #endif
194
+ public static func lower(_ value: SwiftType) -> FfiType {
195
+ return value
196
+ }
197
+ }
198
+
199
+ // Types conforming to `FfiConverterRustBuffer` lift and lower into a `RustBuffer`.
200
+ // Used for complex types where it's hard to write a custom lift/lower.
201
+ fileprivate protocol FfiConverterRustBuffer: FfiConverter where FfiType == RustBuffer {}
202
+
203
+ extension FfiConverterRustBuffer {
204
+ #if swift(>=5.8)
205
+ @_documentation(visibility: private)
206
+ #endif
207
+ public static func lift(_ buf: RustBuffer) throws -> SwiftType {
208
+ var reader = createReader(data: Data(rustBuffer: buf))
209
+ let value = try read(from: &reader)
210
+ if hasRemaining(reader) {
211
+ throw UniffiInternalError.incompleteData
212
+ }
213
+ buf.deallocate()
214
+ return value
215
+ }
216
+
217
+ #if swift(>=5.8)
218
+ @_documentation(visibility: private)
219
+ #endif
220
+ public static func lower(_ value: SwiftType) -> RustBuffer {
221
+ var writer = createWriter()
222
+ write(value, into: &writer)
223
+ return RustBuffer(bytes: writer)
224
+ }
225
+ }
226
+ // An error type for FFI errors. These errors occur at the UniFFI level, not
227
+ // the library level.
228
+ fileprivate enum UniffiInternalError: LocalizedError {
229
+ case bufferOverflow
230
+ case incompleteData
231
+ case unexpectedOptionalTag
232
+ case unexpectedEnumCase
233
+ case unexpectedNullPointer
234
+ case unexpectedRustCallStatusCode
235
+ case unexpectedRustCallError
236
+ case unexpectedStaleHandle
237
+ case rustPanic(_ message: String)
238
+
239
+ public var errorDescription: String? {
240
+ switch self {
241
+ case .bufferOverflow: return "Reading the requested value would read past the end of the buffer"
242
+ case .incompleteData: return "The buffer still has data after lifting its containing value"
243
+ case .unexpectedOptionalTag: return "Unexpected optional tag; should be 0 or 1"
244
+ case .unexpectedEnumCase: return "Raw enum value doesn't match any cases"
245
+ case .unexpectedNullPointer: return "Raw pointer value was null"
246
+ case .unexpectedRustCallStatusCode: return "Unexpected RustCallStatus code"
247
+ case .unexpectedRustCallError: return "CALL_ERROR but no errorClass specified"
248
+ case .unexpectedStaleHandle: return "The object in the handle map has been dropped already"
249
+ case let .rustPanic(message): return message
250
+ }
251
+ }
252
+ }
253
+
254
+ fileprivate extension NSLock {
255
+ func withLock<T>(f: () throws -> T) rethrows -> T {
256
+ self.lock()
257
+ defer { self.unlock() }
258
+ return try f()
259
+ }
260
+ }
261
+
262
+ fileprivate let CALL_SUCCESS: Int8 = 0
263
+ fileprivate let CALL_ERROR: Int8 = 1
264
+ fileprivate let CALL_UNEXPECTED_ERROR: Int8 = 2
265
+ fileprivate let CALL_CANCELLED: Int8 = 3
266
+
267
+ fileprivate extension RustCallStatus {
268
+ init() {
269
+ self.init(
270
+ code: CALL_SUCCESS,
271
+ errorBuf: RustBuffer.init(
272
+ capacity: 0,
273
+ len: 0,
274
+ data: nil
275
+ )
276
+ )
277
+ }
278
+ }
279
+
280
+ private func rustCall<T>(_ callback: (UnsafeMutablePointer<RustCallStatus>) -> T) throws -> T {
281
+ let neverThrow: ((RustBuffer) throws -> Never)? = nil
282
+ return try makeRustCall(callback, errorHandler: neverThrow)
283
+ }
284
+
285
+ private func rustCallWithError<T, E: Swift.Error>(
286
+ _ errorHandler: @escaping (RustBuffer) throws -> E,
287
+ _ callback: (UnsafeMutablePointer<RustCallStatus>) -> T) throws -> T {
288
+ try makeRustCall(callback, errorHandler: errorHandler)
289
+ }
290
+
291
+ private func makeRustCall<T, E: Swift.Error>(
292
+ _ callback: (UnsafeMutablePointer<RustCallStatus>) -> T,
293
+ errorHandler: ((RustBuffer) throws -> E)?
294
+ ) throws -> T {
295
+ uniffiEnsureForgeKernelUniffiInitialized()
296
+ var callStatus = RustCallStatus.init()
297
+ let returnedVal = callback(&callStatus)
298
+ try uniffiCheckCallStatus(callStatus: callStatus, errorHandler: errorHandler)
299
+ return returnedVal
300
+ }
301
+
302
+ private func uniffiCheckCallStatus<E: Swift.Error>(
303
+ callStatus: RustCallStatus,
304
+ errorHandler: ((RustBuffer) throws -> E)?
305
+ ) throws {
306
+ switch callStatus.code {
307
+ case CALL_SUCCESS:
308
+ return
309
+
310
+ case CALL_ERROR:
311
+ if let errorHandler = errorHandler {
312
+ throw try errorHandler(callStatus.errorBuf)
313
+ } else {
314
+ callStatus.errorBuf.deallocate()
315
+ throw UniffiInternalError.unexpectedRustCallError
316
+ }
317
+
318
+ case CALL_UNEXPECTED_ERROR:
319
+ // When the rust code sees a panic, it tries to construct a RustBuffer
320
+ // with the message. But if that code panics, then it just sends back
321
+ // an empty buffer.
322
+ if callStatus.errorBuf.len > 0 {
323
+ throw UniffiInternalError.rustPanic(try FfiConverterString.lift(callStatus.errorBuf))
324
+ } else {
325
+ callStatus.errorBuf.deallocate()
326
+ throw UniffiInternalError.rustPanic("Rust panic")
327
+ }
328
+
329
+ case CALL_CANCELLED:
330
+ fatalError("Cancellation not supported yet")
331
+
332
+ default:
333
+ throw UniffiInternalError.unexpectedRustCallStatusCode
334
+ }
335
+ }
336
+
337
+ private func uniffiTraitInterfaceCall<T>(
338
+ callStatus: UnsafeMutablePointer<RustCallStatus>,
339
+ makeCall: () throws -> T,
340
+ writeReturn: (T) -> ()
341
+ ) {
342
+ do {
343
+ try writeReturn(makeCall())
344
+ } catch let error {
345
+ callStatus.pointee.code = CALL_UNEXPECTED_ERROR
346
+ callStatus.pointee.errorBuf = FfiConverterString.lower(String(describing: error))
347
+ }
348
+ }
349
+
350
+ private func uniffiTraitInterfaceCallWithError<T, E>(
351
+ callStatus: UnsafeMutablePointer<RustCallStatus>,
352
+ makeCall: () throws -> T,
353
+ writeReturn: (T) -> (),
354
+ lowerError: (E) -> RustBuffer
355
+ ) {
356
+ do {
357
+ try writeReturn(makeCall())
358
+ } catch let error as E {
359
+ callStatus.pointee.code = CALL_ERROR
360
+ callStatus.pointee.errorBuf = lowerError(error)
361
+ } catch {
362
+ callStatus.pointee.code = CALL_UNEXPECTED_ERROR
363
+ callStatus.pointee.errorBuf = FfiConverterString.lower(String(describing: error))
364
+ }
365
+ }
366
+ // Initial value and increment amount for handles.
367
+ // These ensure that SWIFT handles always have the lowest bit set
368
+ fileprivate let UNIFFI_HANDLEMAP_INITIAL: UInt64 = 1
369
+ fileprivate let UNIFFI_HANDLEMAP_DELTA: UInt64 = 2
370
+
371
+ fileprivate final class UniffiHandleMap<T>: @unchecked Sendable {
372
+ // All mutation happens with this lock held, which is why we implement @unchecked Sendable.
373
+ private let lock = NSLock()
374
+ private var map: [UInt64: T] = [:]
375
+ private var currentHandle: UInt64 = UNIFFI_HANDLEMAP_INITIAL
376
+
377
+ func insert(obj: T) -> UInt64 {
378
+ lock.withLock {
379
+ return doInsert(obj)
380
+ }
381
+ }
382
+
383
+ // Low-level insert function, this assumes `lock` is held.
384
+ private func doInsert(_ obj: T) -> UInt64 {
385
+ let handle = currentHandle
386
+ currentHandle += UNIFFI_HANDLEMAP_DELTA
387
+ map[handle] = obj
388
+ return handle
389
+ }
390
+
391
+ func get(handle: UInt64) throws -> T {
392
+ try lock.withLock {
393
+ guard let obj = map[handle] else {
394
+ throw UniffiInternalError.unexpectedStaleHandle
395
+ }
396
+ return obj
397
+ }
398
+ }
399
+
400
+ func clone(handle: UInt64) throws -> UInt64 {
401
+ try lock.withLock {
402
+ guard let obj = map[handle] else {
403
+ throw UniffiInternalError.unexpectedStaleHandle
404
+ }
405
+ return doInsert(obj)
406
+ }
407
+ }
408
+
409
+ @discardableResult
410
+ func remove(handle: UInt64) throws -> T {
411
+ try lock.withLock {
412
+ guard let obj = map.removeValue(forKey: handle) else {
413
+ throw UniffiInternalError.unexpectedStaleHandle
414
+ }
415
+ return obj
416
+ }
417
+ }
418
+
419
+ var count: Int {
420
+ get {
421
+ map.count
422
+ }
423
+ }
424
+ }
425
+
426
+
427
+ // Public interface members begin here.
428
+ // Magic number for the Rust proxy to call using the same mechanism as every other method,
429
+ // to free the callback once it's dropped by Rust.
430
+ private let IDX_CALLBACK_FREE: Int32 = 0
431
+ // Callback return codes
432
+ private let UNIFFI_CALLBACK_SUCCESS: Int32 = 0
433
+ private let UNIFFI_CALLBACK_ERROR: Int32 = 1
434
+ private let UNIFFI_CALLBACK_UNEXPECTED_ERROR: Int32 = 2
435
+
436
+ #if swift(>=5.8)
437
+ @_documentation(visibility: private)
438
+ #endif
439
+ fileprivate struct FfiConverterUInt16: FfiConverterPrimitive {
440
+ typealias FfiType = UInt16
441
+ typealias SwiftType = UInt16
442
+
443
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UInt16 {
444
+ return try lift(readInt(&buf))
445
+ }
446
+
447
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
448
+ writeInt(&buf, lower(value))
449
+ }
450
+ }
451
+
452
+ #if swift(>=5.8)
453
+ @_documentation(visibility: private)
454
+ #endif
455
+ fileprivate struct FfiConverterUInt32: FfiConverterPrimitive {
456
+ typealias FfiType = UInt32
457
+ typealias SwiftType = UInt32
458
+
459
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UInt32 {
460
+ return try lift(readInt(&buf))
461
+ }
462
+
463
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
464
+ writeInt(&buf, lower(value))
465
+ }
466
+ }
467
+
468
+ #if swift(>=5.8)
469
+ @_documentation(visibility: private)
470
+ #endif
471
+ fileprivate struct FfiConverterUInt64: FfiConverterPrimitive {
472
+ typealias FfiType = UInt64
473
+ typealias SwiftType = UInt64
474
+
475
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UInt64 {
476
+ return try lift(readInt(&buf))
477
+ }
478
+
479
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
480
+ writeInt(&buf, lower(value))
481
+ }
482
+ }
483
+
484
+ #if swift(>=5.8)
485
+ @_documentation(visibility: private)
486
+ #endif
487
+ fileprivate struct FfiConverterInt64: FfiConverterPrimitive {
488
+ typealias FfiType = Int64
489
+ typealias SwiftType = Int64
490
+
491
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Int64 {
492
+ return try lift(readInt(&buf))
493
+ }
494
+
495
+ public static func write(_ value: Int64, into buf: inout [UInt8]) {
496
+ writeInt(&buf, lower(value))
497
+ }
498
+ }
499
+
500
+ #if swift(>=5.8)
501
+ @_documentation(visibility: private)
502
+ #endif
503
+ fileprivate struct FfiConverterDouble: FfiConverterPrimitive {
504
+ typealias FfiType = Double
505
+ typealias SwiftType = Double
506
+
507
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Double {
508
+ return try lift(readDouble(&buf))
509
+ }
510
+
511
+ public static func write(_ value: Double, into buf: inout [UInt8]) {
512
+ writeDouble(&buf, lower(value))
513
+ }
514
+ }
515
+
516
+ #if swift(>=5.8)
517
+ @_documentation(visibility: private)
518
+ #endif
519
+ fileprivate struct FfiConverterBool : FfiConverter {
520
+ typealias FfiType = Int8
521
+ typealias SwiftType = Bool
522
+
523
+ public static func lift(_ value: Int8) throws -> Bool {
524
+ return value != 0
525
+ }
526
+
527
+ public static func lower(_ value: Bool) -> Int8 {
528
+ return value ? 1 : 0
529
+ }
530
+
531
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Bool {
532
+ return try lift(readInt(&buf))
533
+ }
534
+
535
+ public static func write(_ value: Bool, into buf: inout [UInt8]) {
536
+ writeInt(&buf, lower(value))
537
+ }
538
+ }
539
+
540
+ #if swift(>=5.8)
541
+ @_documentation(visibility: private)
542
+ #endif
543
+ fileprivate struct FfiConverterString: FfiConverter {
544
+ typealias SwiftType = String
545
+ typealias FfiType = RustBuffer
546
+
547
+ public static func lift(_ value: RustBuffer) throws -> String {
548
+ defer {
549
+ value.deallocate()
550
+ }
551
+ if value.data == nil {
552
+ return String()
553
+ }
554
+ let bytes = UnsafeBufferPointer<UInt8>(start: value.data!, count: Int(value.len))
555
+ return String(bytes: bytes, encoding: String.Encoding.utf8)!
556
+ }
557
+
558
+ public static func lower(_ value: String) -> RustBuffer {
559
+ return value.utf8CString.withUnsafeBufferPointer { ptr in
560
+ // The swift string gives us int8_t, we want uint8_t.
561
+ ptr.withMemoryRebound(to: UInt8.self) { ptr in
562
+ // The swift string gives us a trailing null byte, we don't want it.
563
+ let buf = UnsafeBufferPointer(rebasing: ptr.prefix(upTo: ptr.count - 1))
564
+ return RustBuffer.from(buf)
565
+ }
566
+ }
567
+ }
568
+
569
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> String {
570
+ let len: Int32 = try readInt(&buf)
571
+ return String(bytes: try readBytes(&buf, count: Int(len)), encoding: String.Encoding.utf8)!
572
+ }
573
+
574
+ public static func write(_ value: String, into buf: inout [UInt8]) {
575
+ let len = Int32(value.utf8.count)
576
+ writeInt(&buf, len)
577
+ writeBytes(&buf, value.utf8)
578
+ }
579
+ }
580
+
581
+
582
+
583
+
584
+ public protocol ForgeRuntimeBridgeProtocol: AnyObject, Sendable {
585
+
586
+ func capturePlan() -> AppleCapturePlan?
587
+
588
+ func clearCapturePlanListener() -> AppleBindingOutcome
589
+
590
+ func clearContentMetadataProvider(viewId: UInt64) -> AppleBindingOutcome
591
+
592
+ func clearSessionPreSendHook() -> AppleBindingOutcome
593
+
594
+ func clearVideoPreSendHook(viewId: UInt64) -> AppleBindingOutcome
595
+
596
+ func createVideoView(nowMs: UInt64, options: AppleVideoOptions) -> UInt64
597
+
598
+ func destroy() -> AppleBindingOutcome
599
+
600
+ func recordAdEvent(viewId: UInt64, event: AppleAdEvent, timestamp: AppleSemanticTimestamp, overridesJson: String, metadata: AppleAdMetadata, adapterVersion: String?) -> AppleBindingOutcome
601
+
602
+ func recordApplicationForeground(foreground: Bool, timemarkMs: UInt64) -> AppleBindingOutcome
603
+
604
+ func recordIdentityEvent(kind: String, timemarkMs: UInt64, fields: [String: String]) -> AppleBindingOutcome
605
+
606
+ func recordNetworkEvent(observation: AppleNetworkObservation) -> AppleBindingOutcome
607
+
608
+ func recordPlayerEvent(viewId: UInt64, event: AppleVideoEvent, timestamp: AppleSemanticTimestamp, overridesJson: String, metadata: AppleContentMetadata) -> AppleBindingOutcome
609
+
610
+ func recordSessionEvent(eventName: String, timemarkMs: UInt64, params: [String: String]) -> AppleBindingOutcome
611
+
612
+ func setCapturePlanListener(listener: AppleCapturePlanListener) -> AppleBindingOutcome
613
+
614
+ func setContentMetadataProvider(viewId: UInt64, provider: AppleContentMetadataProvider) -> AppleBindingOutcome
615
+
616
+ func setLogLevel(logLevel: String) -> AppleBindingOutcome
617
+
618
+ func setSessionPreSendHook(hook: AppleSessionPreSendHook) -> AppleBindingOutcome
619
+
620
+ func setVideoPreSendHook(viewId: UInt64, hook: AppleVideoPreSendHook) -> AppleBindingOutcome
621
+
622
+ func snapshotEvents() -> [AppleRuntimeEventSnapshot]
623
+
624
+ func start(nowMs: UInt64) -> AppleBindingOutcome
625
+
626
+ }
627
+ open class ForgeRuntimeBridge: ForgeRuntimeBridgeProtocol, @unchecked Sendable {
628
+ fileprivate let handle: UInt64
629
+
630
+ /// Used to instantiate a [FFIObject] without an actual handle, for fakes in tests, mostly.
631
+ #if swift(>=5.8)
632
+ @_documentation(visibility: private)
633
+ #endif
634
+ public struct NoHandle {
635
+ public init() {}
636
+ }
637
+
638
+ // TODO: We'd like this to be `private` but for Swifty reasons,
639
+ // we can't implement `FfiConverter` without making this `required` and we can't
640
+ // make it `required` without making it `public`.
641
+ #if swift(>=5.8)
642
+ @_documentation(visibility: private)
643
+ #endif
644
+ required public init(unsafeFromHandle handle: UInt64) {
645
+ self.handle = handle
646
+ }
647
+
648
+ // This constructor can be used to instantiate a fake object.
649
+ // - Parameter noHandle: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject].
650
+ //
651
+ // - Warning:
652
+ // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing handle the FFI lower functions will crash.
653
+ #if swift(>=5.8)
654
+ @_documentation(visibility: private)
655
+ #endif
656
+ public init(noHandle: NoHandle) {
657
+ self.handle = 0
658
+ }
659
+
660
+ #if swift(>=5.8)
661
+ @_documentation(visibility: private)
662
+ #endif
663
+ public func uniffiCloneHandle() -> UInt64 {
664
+ return try! rustCall { uniffi_forge_kernel_uniffi_fn_clone_forgeruntimebridge(self.handle, $0) }
665
+ }
666
+ public convenience init(config: AppleRuntimeConfig) {
667
+ let handle =
668
+ try! rustCall() {
669
+ uniffi_forge_kernel_uniffi_fn_constructor_forgeruntimebridge_new(
670
+ FfiConverterTypeAppleRuntimeConfig_lower(config),$0
671
+ )
672
+ }
673
+ self.init(unsafeFromHandle: handle)
674
+ }
675
+
676
+ deinit {
677
+ if handle == 0 {
678
+ // Mock objects have handle=0 don't try to free them
679
+ return
680
+ }
681
+
682
+ try! rustCall { uniffi_forge_kernel_uniffi_fn_free_forgeruntimebridge(handle, $0) }
683
+ }
684
+
685
+
686
+
687
+
688
+ open func capturePlan() -> AppleCapturePlan? {
689
+ return try! FfiConverterOptionTypeAppleCapturePlan.lift(try! rustCall() {
690
+ uniffi_forge_kernel_uniffi_fn_method_forgeruntimebridge_capture_plan(
691
+ self.uniffiCloneHandle(),$0
692
+ )
693
+ })
694
+ }
695
+
696
+ open func clearCapturePlanListener() -> AppleBindingOutcome {
697
+ return try! FfiConverterTypeAppleBindingOutcome_lift(try! rustCall() {
698
+ uniffi_forge_kernel_uniffi_fn_method_forgeruntimebridge_clear_capture_plan_listener(
699
+ self.uniffiCloneHandle(),$0
700
+ )
701
+ })
702
+ }
703
+
704
+ open func clearContentMetadataProvider(viewId: UInt64) -> AppleBindingOutcome {
705
+ return try! FfiConverterTypeAppleBindingOutcome_lift(try! rustCall() {
706
+ uniffi_forge_kernel_uniffi_fn_method_forgeruntimebridge_clear_content_metadata_provider(
707
+ self.uniffiCloneHandle(),
708
+ FfiConverterUInt64.lower(viewId),$0
709
+ )
710
+ })
711
+ }
712
+
713
+ open func clearSessionPreSendHook() -> AppleBindingOutcome {
714
+ return try! FfiConverterTypeAppleBindingOutcome_lift(try! rustCall() {
715
+ uniffi_forge_kernel_uniffi_fn_method_forgeruntimebridge_clear_session_pre_send_hook(
716
+ self.uniffiCloneHandle(),$0
717
+ )
718
+ })
719
+ }
720
+
721
+ open func clearVideoPreSendHook(viewId: UInt64) -> AppleBindingOutcome {
722
+ return try! FfiConverterTypeAppleBindingOutcome_lift(try! rustCall() {
723
+ uniffi_forge_kernel_uniffi_fn_method_forgeruntimebridge_clear_video_pre_send_hook(
724
+ self.uniffiCloneHandle(),
725
+ FfiConverterUInt64.lower(viewId),$0
726
+ )
727
+ })
728
+ }
729
+
730
+ open func createVideoView(nowMs: UInt64, options: AppleVideoOptions) -> UInt64 {
731
+ return try! FfiConverterUInt64.lift(try! rustCall() {
732
+ uniffi_forge_kernel_uniffi_fn_method_forgeruntimebridge_create_video_view(
733
+ self.uniffiCloneHandle(),
734
+ FfiConverterUInt64.lower(nowMs),
735
+ FfiConverterTypeAppleVideoOptions_lower(options),$0
736
+ )
737
+ })
738
+ }
739
+
740
+ open func destroy() -> AppleBindingOutcome {
741
+ return try! FfiConverterTypeAppleBindingOutcome_lift(try! rustCall() {
742
+ uniffi_forge_kernel_uniffi_fn_method_forgeruntimebridge_destroy(
743
+ self.uniffiCloneHandle(),$0
744
+ )
745
+ })
746
+ }
747
+
748
+ open func recordAdEvent(viewId: UInt64, event: AppleAdEvent, timestamp: AppleSemanticTimestamp, overridesJson: String, metadata: AppleAdMetadata, adapterVersion: String?) -> AppleBindingOutcome {
749
+ return try! FfiConverterTypeAppleBindingOutcome_lift(try! rustCall() {
750
+ uniffi_forge_kernel_uniffi_fn_method_forgeruntimebridge_record_ad_event(
751
+ self.uniffiCloneHandle(),
752
+ FfiConverterUInt64.lower(viewId),
753
+ FfiConverterTypeAppleAdEvent_lower(event),
754
+ FfiConverterTypeAppleSemanticTimestamp_lower(timestamp),
755
+ FfiConverterString.lower(overridesJson),
756
+ FfiConverterTypeAppleAdMetadata_lower(metadata),
757
+ FfiConverterOptionString.lower(adapterVersion),$0
758
+ )
759
+ })
760
+ }
761
+
762
+ open func recordApplicationForeground(foreground: Bool, timemarkMs: UInt64) -> AppleBindingOutcome {
763
+ return try! FfiConverterTypeAppleBindingOutcome_lift(try! rustCall() {
764
+ uniffi_forge_kernel_uniffi_fn_method_forgeruntimebridge_record_application_foreground(
765
+ self.uniffiCloneHandle(),
766
+ FfiConverterBool.lower(foreground),
767
+ FfiConverterUInt64.lower(timemarkMs),$0
768
+ )
769
+ })
770
+ }
771
+
772
+ open func recordIdentityEvent(kind: String, timemarkMs: UInt64, fields: [String: String]) -> AppleBindingOutcome {
773
+ return try! FfiConverterTypeAppleBindingOutcome_lift(try! rustCall() {
774
+ uniffi_forge_kernel_uniffi_fn_method_forgeruntimebridge_record_identity_event(
775
+ self.uniffiCloneHandle(),
776
+ FfiConverterString.lower(kind),
777
+ FfiConverterUInt64.lower(timemarkMs),
778
+ FfiConverterDictionaryStringString.lower(fields),$0
779
+ )
780
+ })
781
+ }
782
+
783
+ open func recordNetworkEvent(observation: AppleNetworkObservation) -> AppleBindingOutcome {
784
+ return try! FfiConverterTypeAppleBindingOutcome_lift(try! rustCall() {
785
+ uniffi_forge_kernel_uniffi_fn_method_forgeruntimebridge_record_network_event(
786
+ self.uniffiCloneHandle(),
787
+ FfiConverterTypeAppleNetworkObservation_lower(observation),$0
788
+ )
789
+ })
790
+ }
791
+
792
+ open func recordPlayerEvent(viewId: UInt64, event: AppleVideoEvent, timestamp: AppleSemanticTimestamp, overridesJson: String, metadata: AppleContentMetadata) -> AppleBindingOutcome {
793
+ return try! FfiConverterTypeAppleBindingOutcome_lift(try! rustCall() {
794
+ uniffi_forge_kernel_uniffi_fn_method_forgeruntimebridge_record_player_event(
795
+ self.uniffiCloneHandle(),
796
+ FfiConverterUInt64.lower(viewId),
797
+ FfiConverterTypeAppleVideoEvent_lower(event),
798
+ FfiConverterTypeAppleSemanticTimestamp_lower(timestamp),
799
+ FfiConverterString.lower(overridesJson),
800
+ FfiConverterTypeAppleContentMetadata_lower(metadata),$0
801
+ )
802
+ })
803
+ }
804
+
805
+ open func recordSessionEvent(eventName: String, timemarkMs: UInt64, params: [String: String]) -> AppleBindingOutcome {
806
+ return try! FfiConverterTypeAppleBindingOutcome_lift(try! rustCall() {
807
+ uniffi_forge_kernel_uniffi_fn_method_forgeruntimebridge_record_session_event(
808
+ self.uniffiCloneHandle(),
809
+ FfiConverterString.lower(eventName),
810
+ FfiConverterUInt64.lower(timemarkMs),
811
+ FfiConverterDictionaryStringString.lower(params),$0
812
+ )
813
+ })
814
+ }
815
+
816
+ open func setCapturePlanListener(listener: AppleCapturePlanListener) -> AppleBindingOutcome {
817
+ return try! FfiConverterTypeAppleBindingOutcome_lift(try! rustCall() {
818
+ uniffi_forge_kernel_uniffi_fn_method_forgeruntimebridge_set_capture_plan_listener(
819
+ self.uniffiCloneHandle(),
820
+ FfiConverterCallbackInterfaceAppleCapturePlanListener_lower(listener),$0
821
+ )
822
+ })
823
+ }
824
+
825
+ open func setContentMetadataProvider(viewId: UInt64, provider: AppleContentMetadataProvider) -> AppleBindingOutcome {
826
+ return try! FfiConverterTypeAppleBindingOutcome_lift(try! rustCall() {
827
+ uniffi_forge_kernel_uniffi_fn_method_forgeruntimebridge_set_content_metadata_provider(
828
+ self.uniffiCloneHandle(),
829
+ FfiConverterUInt64.lower(viewId),
830
+ FfiConverterCallbackInterfaceAppleContentMetadataProvider_lower(provider),$0
831
+ )
832
+ })
833
+ }
834
+
835
+ open func setLogLevel(logLevel: String) -> AppleBindingOutcome {
836
+ return try! FfiConverterTypeAppleBindingOutcome_lift(try! rustCall() {
837
+ uniffi_forge_kernel_uniffi_fn_method_forgeruntimebridge_set_log_level(
838
+ self.uniffiCloneHandle(),
839
+ FfiConverterString.lower(logLevel),$0
840
+ )
841
+ })
842
+ }
843
+
844
+ open func setSessionPreSendHook(hook: AppleSessionPreSendHook) -> AppleBindingOutcome {
845
+ return try! FfiConverterTypeAppleBindingOutcome_lift(try! rustCall() {
846
+ uniffi_forge_kernel_uniffi_fn_method_forgeruntimebridge_set_session_pre_send_hook(
847
+ self.uniffiCloneHandle(),
848
+ FfiConverterCallbackInterfaceAppleSessionPreSendHook_lower(hook),$0
849
+ )
850
+ })
851
+ }
852
+
853
+ open func setVideoPreSendHook(viewId: UInt64, hook: AppleVideoPreSendHook) -> AppleBindingOutcome {
854
+ return try! FfiConverterTypeAppleBindingOutcome_lift(try! rustCall() {
855
+ uniffi_forge_kernel_uniffi_fn_method_forgeruntimebridge_set_video_pre_send_hook(
856
+ self.uniffiCloneHandle(),
857
+ FfiConverterUInt64.lower(viewId),
858
+ FfiConverterCallbackInterfaceAppleVideoPreSendHook_lower(hook),$0
859
+ )
860
+ })
861
+ }
862
+
863
+ open func snapshotEvents() -> [AppleRuntimeEventSnapshot] {
864
+ return try! FfiConverterSequenceTypeAppleRuntimeEventSnapshot.lift(try! rustCall() {
865
+ uniffi_forge_kernel_uniffi_fn_method_forgeruntimebridge_snapshot_events(
866
+ self.uniffiCloneHandle(),$0
867
+ )
868
+ })
869
+ }
870
+
871
+ open func start(nowMs: UInt64) -> AppleBindingOutcome {
872
+ return try! FfiConverterTypeAppleBindingOutcome_lift(try! rustCall() {
873
+ uniffi_forge_kernel_uniffi_fn_method_forgeruntimebridge_start(
874
+ self.uniffiCloneHandle(),
875
+ FfiConverterUInt64.lower(nowMs),$0
876
+ )
877
+ })
878
+ }
879
+
880
+
881
+
882
+ }
883
+
884
+
885
+ #if swift(>=5.8)
886
+ @_documentation(visibility: private)
887
+ #endif
888
+ public struct FfiConverterTypeForgeRuntimeBridge: FfiConverter {
889
+ typealias FfiType = UInt64
890
+ typealias SwiftType = ForgeRuntimeBridge
891
+
892
+ public static func lift(_ handle: UInt64) throws -> ForgeRuntimeBridge {
893
+ return ForgeRuntimeBridge(unsafeFromHandle: handle)
894
+ }
895
+
896
+ public static func lower(_ value: ForgeRuntimeBridge) -> UInt64 {
897
+ return value.uniffiCloneHandle()
898
+ }
899
+
900
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ForgeRuntimeBridge {
901
+ let handle: UInt64 = try readInt(&buf)
902
+ return try lift(handle)
903
+ }
904
+
905
+ public static func write(_ value: ForgeRuntimeBridge, into buf: inout [UInt8]) {
906
+ writeInt(&buf, lower(value))
907
+ }
908
+ }
909
+
910
+
911
+ #if swift(>=5.8)
912
+ @_documentation(visibility: private)
913
+ #endif
914
+ public func FfiConverterTypeForgeRuntimeBridge_lift(_ handle: UInt64) throws -> ForgeRuntimeBridge {
915
+ return try FfiConverterTypeForgeRuntimeBridge.lift(handle)
916
+ }
917
+
918
+ #if swift(>=5.8)
919
+ @_documentation(visibility: private)
920
+ #endif
921
+ public func FfiConverterTypeForgeRuntimeBridge_lower(_ value: ForgeRuntimeBridge) -> UInt64 {
922
+ return FfiConverterTypeForgeRuntimeBridge.lower(value)
923
+ }
924
+
925
+
926
+
927
+
928
+ public struct AppleAdMetadata: Equatable, Hashable {
929
+ public var creativeId: String?
930
+ public var adUrl: String?
931
+ public var adTitle: String?
932
+ public var adDurationMs: UInt64?
933
+ public var adPlayheadMs: UInt64?
934
+ public var adBitrate: Int64?
935
+ public var position: AppleAdPosition?
936
+ public var skippable: Bool?
937
+ public var quartile: UInt32?
938
+ public var insertionType: AppleAdInsertionType
939
+ public var viewability: AppleAdViewabilitySample?
940
+ public var errorCode: String?
941
+ public var errorMessage: String?
942
+ public var errorMetadata: String?
943
+ public var errorLevel: String?
944
+ public var extraParams: [String: String]?
945
+
946
+ // Default memberwise initializers are never public by default, so we
947
+ // declare one manually.
948
+ public init(creativeId: String?, adUrl: String?, adTitle: String?, adDurationMs: UInt64?, adPlayheadMs: UInt64?, adBitrate: Int64?, position: AppleAdPosition?, skippable: Bool?, quartile: UInt32?, insertionType: AppleAdInsertionType, viewability: AppleAdViewabilitySample?, errorCode: String?, errorMessage: String?, errorMetadata: String?, errorLevel: String?, extraParams: [String: String]?) {
949
+ self.creativeId = creativeId
950
+ self.adUrl = adUrl
951
+ self.adTitle = adTitle
952
+ self.adDurationMs = adDurationMs
953
+ self.adPlayheadMs = adPlayheadMs
954
+ self.adBitrate = adBitrate
955
+ self.position = position
956
+ self.skippable = skippable
957
+ self.quartile = quartile
958
+ self.insertionType = insertionType
959
+ self.viewability = viewability
960
+ self.errorCode = errorCode
961
+ self.errorMessage = errorMessage
962
+ self.errorMetadata = errorMetadata
963
+ self.errorLevel = errorLevel
964
+ self.extraParams = extraParams
965
+ }
966
+
967
+
968
+
969
+
970
+ }
971
+
972
+ #if compiler(>=6)
973
+ extension AppleAdMetadata: Sendable {}
974
+ #endif
975
+
976
+ #if swift(>=5.8)
977
+ @_documentation(visibility: private)
978
+ #endif
979
+ public struct FfiConverterTypeAppleAdMetadata: FfiConverterRustBuffer {
980
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppleAdMetadata {
981
+ return
982
+ try AppleAdMetadata(
983
+ creativeId: FfiConverterOptionString.read(from: &buf),
984
+ adUrl: FfiConverterOptionString.read(from: &buf),
985
+ adTitle: FfiConverterOptionString.read(from: &buf),
986
+ adDurationMs: FfiConverterOptionUInt64.read(from: &buf),
987
+ adPlayheadMs: FfiConverterOptionUInt64.read(from: &buf),
988
+ adBitrate: FfiConverterOptionInt64.read(from: &buf),
989
+ position: FfiConverterOptionTypeAppleAdPosition.read(from: &buf),
990
+ skippable: FfiConverterOptionBool.read(from: &buf),
991
+ quartile: FfiConverterOptionUInt32.read(from: &buf),
992
+ insertionType: FfiConverterTypeAppleAdInsertionType.read(from: &buf),
993
+ viewability: FfiConverterOptionTypeAppleAdViewabilitySample.read(from: &buf),
994
+ errorCode: FfiConverterOptionString.read(from: &buf),
995
+ errorMessage: FfiConverterOptionString.read(from: &buf),
996
+ errorMetadata: FfiConverterOptionString.read(from: &buf),
997
+ errorLevel: FfiConverterOptionString.read(from: &buf),
998
+ extraParams: FfiConverterOptionDictionaryStringString.read(from: &buf)
999
+ )
1000
+ }
1001
+
1002
+ public static func write(_ value: AppleAdMetadata, into buf: inout [UInt8]) {
1003
+ FfiConverterOptionString.write(value.creativeId, into: &buf)
1004
+ FfiConverterOptionString.write(value.adUrl, into: &buf)
1005
+ FfiConverterOptionString.write(value.adTitle, into: &buf)
1006
+ FfiConverterOptionUInt64.write(value.adDurationMs, into: &buf)
1007
+ FfiConverterOptionUInt64.write(value.adPlayheadMs, into: &buf)
1008
+ FfiConverterOptionInt64.write(value.adBitrate, into: &buf)
1009
+ FfiConverterOptionTypeAppleAdPosition.write(value.position, into: &buf)
1010
+ FfiConverterOptionBool.write(value.skippable, into: &buf)
1011
+ FfiConverterOptionUInt32.write(value.quartile, into: &buf)
1012
+ FfiConverterTypeAppleAdInsertionType.write(value.insertionType, into: &buf)
1013
+ FfiConverterOptionTypeAppleAdViewabilitySample.write(value.viewability, into: &buf)
1014
+ FfiConverterOptionString.write(value.errorCode, into: &buf)
1015
+ FfiConverterOptionString.write(value.errorMessage, into: &buf)
1016
+ FfiConverterOptionString.write(value.errorMetadata, into: &buf)
1017
+ FfiConverterOptionString.write(value.errorLevel, into: &buf)
1018
+ FfiConverterOptionDictionaryStringString.write(value.extraParams, into: &buf)
1019
+ }
1020
+ }
1021
+
1022
+
1023
+ #if swift(>=5.8)
1024
+ @_documentation(visibility: private)
1025
+ #endif
1026
+ public func FfiConverterTypeAppleAdMetadata_lift(_ buf: RustBuffer) throws -> AppleAdMetadata {
1027
+ return try FfiConverterTypeAppleAdMetadata.lift(buf)
1028
+ }
1029
+
1030
+ #if swift(>=5.8)
1031
+ @_documentation(visibility: private)
1032
+ #endif
1033
+ public func FfiConverterTypeAppleAdMetadata_lower(_ value: AppleAdMetadata) -> RustBuffer {
1034
+ return FfiConverterTypeAppleAdMetadata.lower(value)
1035
+ }
1036
+
1037
+
1038
+ public struct AppleAdViewabilitySample: Equatable, Hashable {
1039
+ public var maxIntervalMs: Int64?
1040
+ public var viewedDurationMs: UInt64?
1041
+
1042
+ // Default memberwise initializers are never public by default, so we
1043
+ // declare one manually.
1044
+ public init(maxIntervalMs: Int64?, viewedDurationMs: UInt64?) {
1045
+ self.maxIntervalMs = maxIntervalMs
1046
+ self.viewedDurationMs = viewedDurationMs
1047
+ }
1048
+
1049
+
1050
+
1051
+
1052
+ }
1053
+
1054
+ #if compiler(>=6)
1055
+ extension AppleAdViewabilitySample: Sendable {}
1056
+ #endif
1057
+
1058
+ #if swift(>=5.8)
1059
+ @_documentation(visibility: private)
1060
+ #endif
1061
+ public struct FfiConverterTypeAppleAdViewabilitySample: FfiConverterRustBuffer {
1062
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppleAdViewabilitySample {
1063
+ return
1064
+ try AppleAdViewabilitySample(
1065
+ maxIntervalMs: FfiConverterOptionInt64.read(from: &buf),
1066
+ viewedDurationMs: FfiConverterOptionUInt64.read(from: &buf)
1067
+ )
1068
+ }
1069
+
1070
+ public static func write(_ value: AppleAdViewabilitySample, into buf: inout [UInt8]) {
1071
+ FfiConverterOptionInt64.write(value.maxIntervalMs, into: &buf)
1072
+ FfiConverterOptionUInt64.write(value.viewedDurationMs, into: &buf)
1073
+ }
1074
+ }
1075
+
1076
+
1077
+ #if swift(>=5.8)
1078
+ @_documentation(visibility: private)
1079
+ #endif
1080
+ public func FfiConverterTypeAppleAdViewabilitySample_lift(_ buf: RustBuffer) throws -> AppleAdViewabilitySample {
1081
+ return try FfiConverterTypeAppleAdViewabilitySample.lift(buf)
1082
+ }
1083
+
1084
+ #if swift(>=5.8)
1085
+ @_documentation(visibility: private)
1086
+ #endif
1087
+ public func FfiConverterTypeAppleAdViewabilitySample_lower(_ value: AppleAdViewabilitySample) -> RustBuffer {
1088
+ return FfiConverterTypeAppleAdViewabilitySample.lower(value)
1089
+ }
1090
+
1091
+
1092
+ public struct AppleBindingOutcome: Equatable, Hashable {
1093
+ public var status: AppleBindingStatus
1094
+ public var reason: String?
1095
+
1096
+ // Default memberwise initializers are never public by default, so we
1097
+ // declare one manually.
1098
+ public init(status: AppleBindingStatus, reason: String?) {
1099
+ self.status = status
1100
+ self.reason = reason
1101
+ }
1102
+
1103
+
1104
+
1105
+
1106
+ }
1107
+
1108
+ #if compiler(>=6)
1109
+ extension AppleBindingOutcome: Sendable {}
1110
+ #endif
1111
+
1112
+ #if swift(>=5.8)
1113
+ @_documentation(visibility: private)
1114
+ #endif
1115
+ public struct FfiConverterTypeAppleBindingOutcome: FfiConverterRustBuffer {
1116
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppleBindingOutcome {
1117
+ return
1118
+ try AppleBindingOutcome(
1119
+ status: FfiConverterTypeAppleBindingStatus.read(from: &buf),
1120
+ reason: FfiConverterOptionString.read(from: &buf)
1121
+ )
1122
+ }
1123
+
1124
+ public static func write(_ value: AppleBindingOutcome, into buf: inout [UInt8]) {
1125
+ FfiConverterTypeAppleBindingStatus.write(value.status, into: &buf)
1126
+ FfiConverterOptionString.write(value.reason, into: &buf)
1127
+ }
1128
+ }
1129
+
1130
+
1131
+ #if swift(>=5.8)
1132
+ @_documentation(visibility: private)
1133
+ #endif
1134
+ public func FfiConverterTypeAppleBindingOutcome_lift(_ buf: RustBuffer) throws -> AppleBindingOutcome {
1135
+ return try FfiConverterTypeAppleBindingOutcome.lift(buf)
1136
+ }
1137
+
1138
+ #if swift(>=5.8)
1139
+ @_documentation(visibility: private)
1140
+ #endif
1141
+ public func FfiConverterTypeAppleBindingOutcome_lower(_ value: AppleBindingOutcome) -> RustBuffer {
1142
+ return FfiConverterTypeAppleBindingOutcome.lower(value)
1143
+ }
1144
+
1145
+
1146
+ public struct AppleCapturePlan: Equatable, Hashable {
1147
+ public var planSeq: UInt64
1148
+ public var bits: UInt32
1149
+ public var configVersion: String?
1150
+ public var focusDwellThresholdMs: UInt64
1151
+ public var focusDedupeMs: UInt64
1152
+ public var focusRepeatUnchangedDwell: Bool
1153
+ public var maxTargetTextLength: UInt32
1154
+ public var maxPayloadFields: UInt32
1155
+ public var joinMethod: String?
1156
+ public var seekHeuristicEnabled: Bool?
1157
+ public var seekJumpThresholdMs: UInt64?
1158
+ public var metadataSamplingMs: UInt64?
1159
+ public var sectionsVisibilityThresholdPct: UInt32
1160
+ public var sectionsImpressionMinVisibleMs: UInt64
1161
+ public var sectionsDwellMs: UInt64
1162
+ public var sectionsMaxTrackedItems: UInt32
1163
+ public var sectionsMaxSections: UInt32
1164
+ public var sectionsSectionSelector: String?
1165
+ public var sectionsItemSelector: String?
1166
+ public var sectionsSectionNativeIds: [String]
1167
+ public var sectionsItemNativeIds: [String]
1168
+ public var sectionsNameFrom: String
1169
+ public var targetDataAttributes: [String]
1170
+ public var attributionExtraQueryKeys: [String]
1171
+ public var attributionIncludeLandingUrl: Bool
1172
+ public var attributionDeriveFromDeepLinks: Bool
1173
+ public var attributionInstallReferrerEnabled: Bool
1174
+ public var hash: String
1175
+
1176
+ // Default memberwise initializers are never public by default, so we
1177
+ // declare one manually.
1178
+ public init(planSeq: UInt64, bits: UInt32, configVersion: String?, focusDwellThresholdMs: UInt64, focusDedupeMs: UInt64, focusRepeatUnchangedDwell: Bool, maxTargetTextLength: UInt32, maxPayloadFields: UInt32, joinMethod: String?, seekHeuristicEnabled: Bool?, seekJumpThresholdMs: UInt64?, metadataSamplingMs: UInt64?, sectionsVisibilityThresholdPct: UInt32, sectionsImpressionMinVisibleMs: UInt64, sectionsDwellMs: UInt64, sectionsMaxTrackedItems: UInt32, sectionsMaxSections: UInt32, sectionsSectionSelector: String?, sectionsItemSelector: String?, sectionsSectionNativeIds: [String], sectionsItemNativeIds: [String], sectionsNameFrom: String, targetDataAttributes: [String], attributionExtraQueryKeys: [String], attributionIncludeLandingUrl: Bool, attributionDeriveFromDeepLinks: Bool, attributionInstallReferrerEnabled: Bool, hash: String) {
1179
+ self.planSeq = planSeq
1180
+ self.bits = bits
1181
+ self.configVersion = configVersion
1182
+ self.focusDwellThresholdMs = focusDwellThresholdMs
1183
+ self.focusDedupeMs = focusDedupeMs
1184
+ self.focusRepeatUnchangedDwell = focusRepeatUnchangedDwell
1185
+ self.maxTargetTextLength = maxTargetTextLength
1186
+ self.maxPayloadFields = maxPayloadFields
1187
+ self.joinMethod = joinMethod
1188
+ self.seekHeuristicEnabled = seekHeuristicEnabled
1189
+ self.seekJumpThresholdMs = seekJumpThresholdMs
1190
+ self.metadataSamplingMs = metadataSamplingMs
1191
+ self.sectionsVisibilityThresholdPct = sectionsVisibilityThresholdPct
1192
+ self.sectionsImpressionMinVisibleMs = sectionsImpressionMinVisibleMs
1193
+ self.sectionsDwellMs = sectionsDwellMs
1194
+ self.sectionsMaxTrackedItems = sectionsMaxTrackedItems
1195
+ self.sectionsMaxSections = sectionsMaxSections
1196
+ self.sectionsSectionSelector = sectionsSectionSelector
1197
+ self.sectionsItemSelector = sectionsItemSelector
1198
+ self.sectionsSectionNativeIds = sectionsSectionNativeIds
1199
+ self.sectionsItemNativeIds = sectionsItemNativeIds
1200
+ self.sectionsNameFrom = sectionsNameFrom
1201
+ self.targetDataAttributes = targetDataAttributes
1202
+ self.attributionExtraQueryKeys = attributionExtraQueryKeys
1203
+ self.attributionIncludeLandingUrl = attributionIncludeLandingUrl
1204
+ self.attributionDeriveFromDeepLinks = attributionDeriveFromDeepLinks
1205
+ self.attributionInstallReferrerEnabled = attributionInstallReferrerEnabled
1206
+ self.hash = hash
1207
+ }
1208
+
1209
+
1210
+
1211
+
1212
+ }
1213
+
1214
+ #if compiler(>=6)
1215
+ extension AppleCapturePlan: Sendable {}
1216
+ #endif
1217
+
1218
+ #if swift(>=5.8)
1219
+ @_documentation(visibility: private)
1220
+ #endif
1221
+ public struct FfiConverterTypeAppleCapturePlan: FfiConverterRustBuffer {
1222
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppleCapturePlan {
1223
+ return
1224
+ try AppleCapturePlan(
1225
+ planSeq: FfiConverterUInt64.read(from: &buf),
1226
+ bits: FfiConverterUInt32.read(from: &buf),
1227
+ configVersion: FfiConverterOptionString.read(from: &buf),
1228
+ focusDwellThresholdMs: FfiConverterUInt64.read(from: &buf),
1229
+ focusDedupeMs: FfiConverterUInt64.read(from: &buf),
1230
+ focusRepeatUnchangedDwell: FfiConverterBool.read(from: &buf),
1231
+ maxTargetTextLength: FfiConverterUInt32.read(from: &buf),
1232
+ maxPayloadFields: FfiConverterUInt32.read(from: &buf),
1233
+ joinMethod: FfiConverterOptionString.read(from: &buf),
1234
+ seekHeuristicEnabled: FfiConverterOptionBool.read(from: &buf),
1235
+ seekJumpThresholdMs: FfiConverterOptionUInt64.read(from: &buf),
1236
+ metadataSamplingMs: FfiConverterOptionUInt64.read(from: &buf),
1237
+ sectionsVisibilityThresholdPct: FfiConverterUInt32.read(from: &buf),
1238
+ sectionsImpressionMinVisibleMs: FfiConverterUInt64.read(from: &buf),
1239
+ sectionsDwellMs: FfiConverterUInt64.read(from: &buf),
1240
+ sectionsMaxTrackedItems: FfiConverterUInt32.read(from: &buf),
1241
+ sectionsMaxSections: FfiConverterUInt32.read(from: &buf),
1242
+ sectionsSectionSelector: FfiConverterOptionString.read(from: &buf),
1243
+ sectionsItemSelector: FfiConverterOptionString.read(from: &buf),
1244
+ sectionsSectionNativeIds: FfiConverterSequenceString.read(from: &buf),
1245
+ sectionsItemNativeIds: FfiConverterSequenceString.read(from: &buf),
1246
+ sectionsNameFrom: FfiConverterString.read(from: &buf),
1247
+ targetDataAttributes: FfiConverterSequenceString.read(from: &buf),
1248
+ attributionExtraQueryKeys: FfiConverterSequenceString.read(from: &buf),
1249
+ attributionIncludeLandingUrl: FfiConverterBool.read(from: &buf),
1250
+ attributionDeriveFromDeepLinks: FfiConverterBool.read(from: &buf),
1251
+ attributionInstallReferrerEnabled: FfiConverterBool.read(from: &buf),
1252
+ hash: FfiConverterString.read(from: &buf)
1253
+ )
1254
+ }
1255
+
1256
+ public static func write(_ value: AppleCapturePlan, into buf: inout [UInt8]) {
1257
+ FfiConverterUInt64.write(value.planSeq, into: &buf)
1258
+ FfiConverterUInt32.write(value.bits, into: &buf)
1259
+ FfiConverterOptionString.write(value.configVersion, into: &buf)
1260
+ FfiConverterUInt64.write(value.focusDwellThresholdMs, into: &buf)
1261
+ FfiConverterUInt64.write(value.focusDedupeMs, into: &buf)
1262
+ FfiConverterBool.write(value.focusRepeatUnchangedDwell, into: &buf)
1263
+ FfiConverterUInt32.write(value.maxTargetTextLength, into: &buf)
1264
+ FfiConverterUInt32.write(value.maxPayloadFields, into: &buf)
1265
+ FfiConverterOptionString.write(value.joinMethod, into: &buf)
1266
+ FfiConverterOptionBool.write(value.seekHeuristicEnabled, into: &buf)
1267
+ FfiConverterOptionUInt64.write(value.seekJumpThresholdMs, into: &buf)
1268
+ FfiConverterOptionUInt64.write(value.metadataSamplingMs, into: &buf)
1269
+ FfiConverterUInt32.write(value.sectionsVisibilityThresholdPct, into: &buf)
1270
+ FfiConverterUInt64.write(value.sectionsImpressionMinVisibleMs, into: &buf)
1271
+ FfiConverterUInt64.write(value.sectionsDwellMs, into: &buf)
1272
+ FfiConverterUInt32.write(value.sectionsMaxTrackedItems, into: &buf)
1273
+ FfiConverterUInt32.write(value.sectionsMaxSections, into: &buf)
1274
+ FfiConverterOptionString.write(value.sectionsSectionSelector, into: &buf)
1275
+ FfiConverterOptionString.write(value.sectionsItemSelector, into: &buf)
1276
+ FfiConverterSequenceString.write(value.sectionsSectionNativeIds, into: &buf)
1277
+ FfiConverterSequenceString.write(value.sectionsItemNativeIds, into: &buf)
1278
+ FfiConverterString.write(value.sectionsNameFrom, into: &buf)
1279
+ FfiConverterSequenceString.write(value.targetDataAttributes, into: &buf)
1280
+ FfiConverterSequenceString.write(value.attributionExtraQueryKeys, into: &buf)
1281
+ FfiConverterBool.write(value.attributionIncludeLandingUrl, into: &buf)
1282
+ FfiConverterBool.write(value.attributionDeriveFromDeepLinks, into: &buf)
1283
+ FfiConverterBool.write(value.attributionInstallReferrerEnabled, into: &buf)
1284
+ FfiConverterString.write(value.hash, into: &buf)
1285
+ }
1286
+ }
1287
+
1288
+
1289
+ #if swift(>=5.8)
1290
+ @_documentation(visibility: private)
1291
+ #endif
1292
+ public func FfiConverterTypeAppleCapturePlan_lift(_ buf: RustBuffer) throws -> AppleCapturePlan {
1293
+ return try FfiConverterTypeAppleCapturePlan.lift(buf)
1294
+ }
1295
+
1296
+ #if swift(>=5.8)
1297
+ @_documentation(visibility: private)
1298
+ #endif
1299
+ public func FfiConverterTypeAppleCapturePlan_lower(_ value: AppleCapturePlan) -> RustBuffer {
1300
+ return FfiConverterTypeAppleCapturePlan.lower(value)
1301
+ }
1302
+
1303
+
1304
+ public struct AppleContentMetadata: Equatable, Hashable {
1305
+ public var player: String
1306
+ public var playerVersion: String?
1307
+ public var resource: String?
1308
+ public var parsedResource: String?
1309
+ public var title: String?
1310
+ public var program: String?
1311
+ public var transactionCode: String?
1312
+ public var contentId: String?
1313
+ public var contentType: AppleContentType
1314
+ public var playheadMs: UInt64?
1315
+ public var durationMs: UInt64?
1316
+ public var bitrate: Int64?
1317
+ public var throughput: Double?
1318
+ public var totalBytes: Int64?
1319
+ public var droppedFrames: UInt64?
1320
+ public var rendition: String?
1321
+ public var videoCodec: String?
1322
+ public var audioCodec: String?
1323
+ public var codecProfile: String?
1324
+ public var containerFormat: String?
1325
+ public var legacyCustomDimensions: [String: String]?
1326
+ public var customDimensions: [String: String]?
1327
+ public var customMetrics: [String: Double]?
1328
+ public var errorCode: String?
1329
+ public var errorMessage: String?
1330
+ public var errorMetadata: String?
1331
+ public var errorLevel: String?
1332
+ public var forceInit: Bool?
1333
+ public var convertFromBuffer: Bool?
1334
+ public var convertFromSeek: Bool?
1335
+ public var customEventJson: String?
1336
+ public var extraParams: [String: String]?
1337
+
1338
+ // Default memberwise initializers are never public by default, so we
1339
+ // declare one manually.
1340
+ public init(player: String, playerVersion: String?, resource: String?, parsedResource: String?, title: String?, program: String?, transactionCode: String?, contentId: String?, contentType: AppleContentType, playheadMs: UInt64?, durationMs: UInt64?, bitrate: Int64?, throughput: Double?, totalBytes: Int64?, droppedFrames: UInt64?, rendition: String?, videoCodec: String?, audioCodec: String?, codecProfile: String?, containerFormat: String?, legacyCustomDimensions: [String: String]?, customDimensions: [String: String]?, customMetrics: [String: Double]?, errorCode: String?, errorMessage: String?, errorMetadata: String?, errorLevel: String?, forceInit: Bool?, convertFromBuffer: Bool?, convertFromSeek: Bool?, customEventJson: String?, extraParams: [String: String]?) {
1341
+ self.player = player
1342
+ self.playerVersion = playerVersion
1343
+ self.resource = resource
1344
+ self.parsedResource = parsedResource
1345
+ self.title = title
1346
+ self.program = program
1347
+ self.transactionCode = transactionCode
1348
+ self.contentId = contentId
1349
+ self.contentType = contentType
1350
+ self.playheadMs = playheadMs
1351
+ self.durationMs = durationMs
1352
+ self.bitrate = bitrate
1353
+ self.throughput = throughput
1354
+ self.totalBytes = totalBytes
1355
+ self.droppedFrames = droppedFrames
1356
+ self.rendition = rendition
1357
+ self.videoCodec = videoCodec
1358
+ self.audioCodec = audioCodec
1359
+ self.codecProfile = codecProfile
1360
+ self.containerFormat = containerFormat
1361
+ self.legacyCustomDimensions = legacyCustomDimensions
1362
+ self.customDimensions = customDimensions
1363
+ self.customMetrics = customMetrics
1364
+ self.errorCode = errorCode
1365
+ self.errorMessage = errorMessage
1366
+ self.errorMetadata = errorMetadata
1367
+ self.errorLevel = errorLevel
1368
+ self.forceInit = forceInit
1369
+ self.convertFromBuffer = convertFromBuffer
1370
+ self.convertFromSeek = convertFromSeek
1371
+ self.customEventJson = customEventJson
1372
+ self.extraParams = extraParams
1373
+ }
1374
+
1375
+
1376
+
1377
+
1378
+ }
1379
+
1380
+ #if compiler(>=6)
1381
+ extension AppleContentMetadata: Sendable {}
1382
+ #endif
1383
+
1384
+ #if swift(>=5.8)
1385
+ @_documentation(visibility: private)
1386
+ #endif
1387
+ public struct FfiConverterTypeAppleContentMetadata: FfiConverterRustBuffer {
1388
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppleContentMetadata {
1389
+ return
1390
+ try AppleContentMetadata(
1391
+ player: FfiConverterString.read(from: &buf),
1392
+ playerVersion: FfiConverterOptionString.read(from: &buf),
1393
+ resource: FfiConverterOptionString.read(from: &buf),
1394
+ parsedResource: FfiConverterOptionString.read(from: &buf),
1395
+ title: FfiConverterOptionString.read(from: &buf),
1396
+ program: FfiConverterOptionString.read(from: &buf),
1397
+ transactionCode: FfiConverterOptionString.read(from: &buf),
1398
+ contentId: FfiConverterOptionString.read(from: &buf),
1399
+ contentType: FfiConverterTypeAppleContentType.read(from: &buf),
1400
+ playheadMs: FfiConverterOptionUInt64.read(from: &buf),
1401
+ durationMs: FfiConverterOptionUInt64.read(from: &buf),
1402
+ bitrate: FfiConverterOptionInt64.read(from: &buf),
1403
+ throughput: FfiConverterOptionDouble.read(from: &buf),
1404
+ totalBytes: FfiConverterOptionInt64.read(from: &buf),
1405
+ droppedFrames: FfiConverterOptionUInt64.read(from: &buf),
1406
+ rendition: FfiConverterOptionString.read(from: &buf),
1407
+ videoCodec: FfiConverterOptionString.read(from: &buf),
1408
+ audioCodec: FfiConverterOptionString.read(from: &buf),
1409
+ codecProfile: FfiConverterOptionString.read(from: &buf),
1410
+ containerFormat: FfiConverterOptionString.read(from: &buf),
1411
+ legacyCustomDimensions: FfiConverterOptionDictionaryStringString.read(from: &buf),
1412
+ customDimensions: FfiConverterOptionDictionaryStringString.read(from: &buf),
1413
+ customMetrics: FfiConverterOptionDictionaryStringDouble.read(from: &buf),
1414
+ errorCode: FfiConverterOptionString.read(from: &buf),
1415
+ errorMessage: FfiConverterOptionString.read(from: &buf),
1416
+ errorMetadata: FfiConverterOptionString.read(from: &buf),
1417
+ errorLevel: FfiConverterOptionString.read(from: &buf),
1418
+ forceInit: FfiConverterOptionBool.read(from: &buf),
1419
+ convertFromBuffer: FfiConverterOptionBool.read(from: &buf),
1420
+ convertFromSeek: FfiConverterOptionBool.read(from: &buf),
1421
+ customEventJson: FfiConverterOptionString.read(from: &buf),
1422
+ extraParams: FfiConverterOptionDictionaryStringString.read(from: &buf)
1423
+ )
1424
+ }
1425
+
1426
+ public static func write(_ value: AppleContentMetadata, into buf: inout [UInt8]) {
1427
+ FfiConverterString.write(value.player, into: &buf)
1428
+ FfiConverterOptionString.write(value.playerVersion, into: &buf)
1429
+ FfiConverterOptionString.write(value.resource, into: &buf)
1430
+ FfiConverterOptionString.write(value.parsedResource, into: &buf)
1431
+ FfiConverterOptionString.write(value.title, into: &buf)
1432
+ FfiConverterOptionString.write(value.program, into: &buf)
1433
+ FfiConverterOptionString.write(value.transactionCode, into: &buf)
1434
+ FfiConverterOptionString.write(value.contentId, into: &buf)
1435
+ FfiConverterTypeAppleContentType.write(value.contentType, into: &buf)
1436
+ FfiConverterOptionUInt64.write(value.playheadMs, into: &buf)
1437
+ FfiConverterOptionUInt64.write(value.durationMs, into: &buf)
1438
+ FfiConverterOptionInt64.write(value.bitrate, into: &buf)
1439
+ FfiConverterOptionDouble.write(value.throughput, into: &buf)
1440
+ FfiConverterOptionInt64.write(value.totalBytes, into: &buf)
1441
+ FfiConverterOptionUInt64.write(value.droppedFrames, into: &buf)
1442
+ FfiConverterOptionString.write(value.rendition, into: &buf)
1443
+ FfiConverterOptionString.write(value.videoCodec, into: &buf)
1444
+ FfiConverterOptionString.write(value.audioCodec, into: &buf)
1445
+ FfiConverterOptionString.write(value.codecProfile, into: &buf)
1446
+ FfiConverterOptionString.write(value.containerFormat, into: &buf)
1447
+ FfiConverterOptionDictionaryStringString.write(value.legacyCustomDimensions, into: &buf)
1448
+ FfiConverterOptionDictionaryStringString.write(value.customDimensions, into: &buf)
1449
+ FfiConverterOptionDictionaryStringDouble.write(value.customMetrics, into: &buf)
1450
+ FfiConverterOptionString.write(value.errorCode, into: &buf)
1451
+ FfiConverterOptionString.write(value.errorMessage, into: &buf)
1452
+ FfiConverterOptionString.write(value.errorMetadata, into: &buf)
1453
+ FfiConverterOptionString.write(value.errorLevel, into: &buf)
1454
+ FfiConverterOptionBool.write(value.forceInit, into: &buf)
1455
+ FfiConverterOptionBool.write(value.convertFromBuffer, into: &buf)
1456
+ FfiConverterOptionBool.write(value.convertFromSeek, into: &buf)
1457
+ FfiConverterOptionString.write(value.customEventJson, into: &buf)
1458
+ FfiConverterOptionDictionaryStringString.write(value.extraParams, into: &buf)
1459
+ }
1460
+ }
1461
+
1462
+
1463
+ #if swift(>=5.8)
1464
+ @_documentation(visibility: private)
1465
+ #endif
1466
+ public func FfiConverterTypeAppleContentMetadata_lift(_ buf: RustBuffer) throws -> AppleContentMetadata {
1467
+ return try FfiConverterTypeAppleContentMetadata.lift(buf)
1468
+ }
1469
+
1470
+ #if swift(>=5.8)
1471
+ @_documentation(visibility: private)
1472
+ #endif
1473
+ public func FfiConverterTypeAppleContentMetadata_lower(_ value: AppleContentMetadata) -> RustBuffer {
1474
+ return FfiConverterTypeAppleContentMetadata.lower(value)
1475
+ }
1476
+
1477
+
1478
+ public struct AppleMetadataSnapshot: Equatable, Hashable {
1479
+ public var content: AppleContentMetadata
1480
+ public var qos: AppleQosSnapshot?
1481
+
1482
+ // Default memberwise initializers are never public by default, so we
1483
+ // declare one manually.
1484
+ public init(content: AppleContentMetadata, qos: AppleQosSnapshot?) {
1485
+ self.content = content
1486
+ self.qos = qos
1487
+ }
1488
+
1489
+
1490
+
1491
+
1492
+ }
1493
+
1494
+ #if compiler(>=6)
1495
+ extension AppleMetadataSnapshot: Sendable {}
1496
+ #endif
1497
+
1498
+ #if swift(>=5.8)
1499
+ @_documentation(visibility: private)
1500
+ #endif
1501
+ public struct FfiConverterTypeAppleMetadataSnapshot: FfiConverterRustBuffer {
1502
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppleMetadataSnapshot {
1503
+ return
1504
+ try AppleMetadataSnapshot(
1505
+ content: FfiConverterTypeAppleContentMetadata.read(from: &buf),
1506
+ qos: FfiConverterOptionTypeAppleQosSnapshot.read(from: &buf)
1507
+ )
1508
+ }
1509
+
1510
+ public static func write(_ value: AppleMetadataSnapshot, into buf: inout [UInt8]) {
1511
+ FfiConverterTypeAppleContentMetadata.write(value.content, into: &buf)
1512
+ FfiConverterOptionTypeAppleQosSnapshot.write(value.qos, into: &buf)
1513
+ }
1514
+ }
1515
+
1516
+
1517
+ #if swift(>=5.8)
1518
+ @_documentation(visibility: private)
1519
+ #endif
1520
+ public func FfiConverterTypeAppleMetadataSnapshot_lift(_ buf: RustBuffer) throws -> AppleMetadataSnapshot {
1521
+ return try FfiConverterTypeAppleMetadataSnapshot.lift(buf)
1522
+ }
1523
+
1524
+ #if swift(>=5.8)
1525
+ @_documentation(visibility: private)
1526
+ #endif
1527
+ public func FfiConverterTypeAppleMetadataSnapshot_lower(_ value: AppleMetadataSnapshot) -> RustBuffer {
1528
+ return FfiConverterTypeAppleMetadataSnapshot.lower(value)
1529
+ }
1530
+
1531
+
1532
+ public struct AppleNetworkObservation: Equatable, Hashable {
1533
+ public var eventId: String
1534
+ public var source: String
1535
+ public var targetUrl: String
1536
+ public var method: String
1537
+ public var timemarkMs: UInt64
1538
+ public var durationMs: UInt64
1539
+ public var responseStatusCode: UInt16
1540
+ public var outcome: String
1541
+ public var responseStatusText: String?
1542
+ public var errorMessage: String?
1543
+ public var traceparent: String?
1544
+ public var dnsDurationMs: UInt64?
1545
+ public var connectDurationMs: UInt64?
1546
+ public var sslDurationMs: UInt64?
1547
+ public var requestDurationMs: UInt64?
1548
+ public var timeToFirstByteMs: UInt64?
1549
+ public var responseDownloadDurationMs: UInt64?
1550
+ public var redirectDurationMs: UInt64?
1551
+ public var redirectCount: UInt64?
1552
+ public var `protocol`: String?
1553
+ public var requestBytes: UInt64?
1554
+ public var responseBytes: UInt64?
1555
+ public var requestQuery: [String: String]?
1556
+ public var requestHeaders: [String: String]?
1557
+ public var responseHeaders: [String: String]?
1558
+
1559
+ // Default memberwise initializers are never public by default, so we
1560
+ // declare one manually.
1561
+ public init(eventId: String, source: String, targetUrl: String, method: String, timemarkMs: UInt64, durationMs: UInt64, responseStatusCode: UInt16, outcome: String, responseStatusText: String?, errorMessage: String?, traceparent: String?, dnsDurationMs: UInt64?, connectDurationMs: UInt64?, sslDurationMs: UInt64?, requestDurationMs: UInt64?, timeToFirstByteMs: UInt64?, responseDownloadDurationMs: UInt64?, redirectDurationMs: UInt64?, redirectCount: UInt64?, `protocol`: String?, requestBytes: UInt64?, responseBytes: UInt64?, requestQuery: [String: String]?, requestHeaders: [String: String]?, responseHeaders: [String: String]?) {
1562
+ self.eventId = eventId
1563
+ self.source = source
1564
+ self.targetUrl = targetUrl
1565
+ self.method = method
1566
+ self.timemarkMs = timemarkMs
1567
+ self.durationMs = durationMs
1568
+ self.responseStatusCode = responseStatusCode
1569
+ self.outcome = outcome
1570
+ self.responseStatusText = responseStatusText
1571
+ self.errorMessage = errorMessage
1572
+ self.traceparent = traceparent
1573
+ self.dnsDurationMs = dnsDurationMs
1574
+ self.connectDurationMs = connectDurationMs
1575
+ self.sslDurationMs = sslDurationMs
1576
+ self.requestDurationMs = requestDurationMs
1577
+ self.timeToFirstByteMs = timeToFirstByteMs
1578
+ self.responseDownloadDurationMs = responseDownloadDurationMs
1579
+ self.redirectDurationMs = redirectDurationMs
1580
+ self.redirectCount = redirectCount
1581
+ self.`protocol` = `protocol`
1582
+ self.requestBytes = requestBytes
1583
+ self.responseBytes = responseBytes
1584
+ self.requestQuery = requestQuery
1585
+ self.requestHeaders = requestHeaders
1586
+ self.responseHeaders = responseHeaders
1587
+ }
1588
+
1589
+
1590
+
1591
+
1592
+ }
1593
+
1594
+ #if compiler(>=6)
1595
+ extension AppleNetworkObservation: Sendable {}
1596
+ #endif
1597
+
1598
+ #if swift(>=5.8)
1599
+ @_documentation(visibility: private)
1600
+ #endif
1601
+ public struct FfiConverterTypeAppleNetworkObservation: FfiConverterRustBuffer {
1602
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppleNetworkObservation {
1603
+ return
1604
+ try AppleNetworkObservation(
1605
+ eventId: FfiConverterString.read(from: &buf),
1606
+ source: FfiConverterString.read(from: &buf),
1607
+ targetUrl: FfiConverterString.read(from: &buf),
1608
+ method: FfiConverterString.read(from: &buf),
1609
+ timemarkMs: FfiConverterUInt64.read(from: &buf),
1610
+ durationMs: FfiConverterUInt64.read(from: &buf),
1611
+ responseStatusCode: FfiConverterUInt16.read(from: &buf),
1612
+ outcome: FfiConverterString.read(from: &buf),
1613
+ responseStatusText: FfiConverterOptionString.read(from: &buf),
1614
+ errorMessage: FfiConverterOptionString.read(from: &buf),
1615
+ traceparent: FfiConverterOptionString.read(from: &buf),
1616
+ dnsDurationMs: FfiConverterOptionUInt64.read(from: &buf),
1617
+ connectDurationMs: FfiConverterOptionUInt64.read(from: &buf),
1618
+ sslDurationMs: FfiConverterOptionUInt64.read(from: &buf),
1619
+ requestDurationMs: FfiConverterOptionUInt64.read(from: &buf),
1620
+ timeToFirstByteMs: FfiConverterOptionUInt64.read(from: &buf),
1621
+ responseDownloadDurationMs: FfiConverterOptionUInt64.read(from: &buf),
1622
+ redirectDurationMs: FfiConverterOptionUInt64.read(from: &buf),
1623
+ redirectCount: FfiConverterOptionUInt64.read(from: &buf),
1624
+ protocol: FfiConverterOptionString.read(from: &buf),
1625
+ requestBytes: FfiConverterOptionUInt64.read(from: &buf),
1626
+ responseBytes: FfiConverterOptionUInt64.read(from: &buf),
1627
+ requestQuery: FfiConverterOptionDictionaryStringString.read(from: &buf),
1628
+ requestHeaders: FfiConverterOptionDictionaryStringString.read(from: &buf),
1629
+ responseHeaders: FfiConverterOptionDictionaryStringString.read(from: &buf)
1630
+ )
1631
+ }
1632
+
1633
+ public static func write(_ value: AppleNetworkObservation, into buf: inout [UInt8]) {
1634
+ FfiConverterString.write(value.eventId, into: &buf)
1635
+ FfiConverterString.write(value.source, into: &buf)
1636
+ FfiConverterString.write(value.targetUrl, into: &buf)
1637
+ FfiConverterString.write(value.method, into: &buf)
1638
+ FfiConverterUInt64.write(value.timemarkMs, into: &buf)
1639
+ FfiConverterUInt64.write(value.durationMs, into: &buf)
1640
+ FfiConverterUInt16.write(value.responseStatusCode, into: &buf)
1641
+ FfiConverterString.write(value.outcome, into: &buf)
1642
+ FfiConverterOptionString.write(value.responseStatusText, into: &buf)
1643
+ FfiConverterOptionString.write(value.errorMessage, into: &buf)
1644
+ FfiConverterOptionString.write(value.traceparent, into: &buf)
1645
+ FfiConverterOptionUInt64.write(value.dnsDurationMs, into: &buf)
1646
+ FfiConverterOptionUInt64.write(value.connectDurationMs, into: &buf)
1647
+ FfiConverterOptionUInt64.write(value.sslDurationMs, into: &buf)
1648
+ FfiConverterOptionUInt64.write(value.requestDurationMs, into: &buf)
1649
+ FfiConverterOptionUInt64.write(value.timeToFirstByteMs, into: &buf)
1650
+ FfiConverterOptionUInt64.write(value.responseDownloadDurationMs, into: &buf)
1651
+ FfiConverterOptionUInt64.write(value.redirectDurationMs, into: &buf)
1652
+ FfiConverterOptionUInt64.write(value.redirectCount, into: &buf)
1653
+ FfiConverterOptionString.write(value.`protocol`, into: &buf)
1654
+ FfiConverterOptionUInt64.write(value.requestBytes, into: &buf)
1655
+ FfiConverterOptionUInt64.write(value.responseBytes, into: &buf)
1656
+ FfiConverterOptionDictionaryStringString.write(value.requestQuery, into: &buf)
1657
+ FfiConverterOptionDictionaryStringString.write(value.requestHeaders, into: &buf)
1658
+ FfiConverterOptionDictionaryStringString.write(value.responseHeaders, into: &buf)
1659
+ }
1660
+ }
1661
+
1662
+
1663
+ #if swift(>=5.8)
1664
+ @_documentation(visibility: private)
1665
+ #endif
1666
+ public func FfiConverterTypeAppleNetworkObservation_lift(_ buf: RustBuffer) throws -> AppleNetworkObservation {
1667
+ return try FfiConverterTypeAppleNetworkObservation.lift(buf)
1668
+ }
1669
+
1670
+ #if swift(>=5.8)
1671
+ @_documentation(visibility: private)
1672
+ #endif
1673
+ public func FfiConverterTypeAppleNetworkObservation_lower(_ value: AppleNetworkObservation) -> RustBuffer {
1674
+ return FfiConverterTypeAppleNetworkObservation.lower(value)
1675
+ }
1676
+
1677
+
1678
+ public struct ApplePreSessionEventPolicy: Equatable, Hashable {
1679
+ public var processEventsBeforeSessionStart: Bool
1680
+ public var queueLimitEvents: UInt64
1681
+ public var maxAgeMs: UInt64
1682
+
1683
+ // Default memberwise initializers are never public by default, so we
1684
+ // declare one manually.
1685
+ public init(processEventsBeforeSessionStart: Bool, queueLimitEvents: UInt64, maxAgeMs: UInt64) {
1686
+ self.processEventsBeforeSessionStart = processEventsBeforeSessionStart
1687
+ self.queueLimitEvents = queueLimitEvents
1688
+ self.maxAgeMs = maxAgeMs
1689
+ }
1690
+
1691
+
1692
+
1693
+
1694
+ }
1695
+
1696
+ #if compiler(>=6)
1697
+ extension ApplePreSessionEventPolicy: Sendable {}
1698
+ #endif
1699
+
1700
+ #if swift(>=5.8)
1701
+ @_documentation(visibility: private)
1702
+ #endif
1703
+ public struct FfiConverterTypeApplePreSessionEventPolicy: FfiConverterRustBuffer {
1704
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ApplePreSessionEventPolicy {
1705
+ return
1706
+ try ApplePreSessionEventPolicy(
1707
+ processEventsBeforeSessionStart: FfiConverterBool.read(from: &buf),
1708
+ queueLimitEvents: FfiConverterUInt64.read(from: &buf),
1709
+ maxAgeMs: FfiConverterUInt64.read(from: &buf)
1710
+ )
1711
+ }
1712
+
1713
+ public static func write(_ value: ApplePreSessionEventPolicy, into buf: inout [UInt8]) {
1714
+ FfiConverterBool.write(value.processEventsBeforeSessionStart, into: &buf)
1715
+ FfiConverterUInt64.write(value.queueLimitEvents, into: &buf)
1716
+ FfiConverterUInt64.write(value.maxAgeMs, into: &buf)
1717
+ }
1718
+ }
1719
+
1720
+
1721
+ #if swift(>=5.8)
1722
+ @_documentation(visibility: private)
1723
+ #endif
1724
+ public func FfiConverterTypeApplePreSessionEventPolicy_lift(_ buf: RustBuffer) throws -> ApplePreSessionEventPolicy {
1725
+ return try FfiConverterTypeApplePreSessionEventPolicy.lift(buf)
1726
+ }
1727
+
1728
+ #if swift(>=5.8)
1729
+ @_documentation(visibility: private)
1730
+ #endif
1731
+ public func FfiConverterTypeApplePreSessionEventPolicy_lower(_ value: ApplePreSessionEventPolicy) -> RustBuffer {
1732
+ return FfiConverterTypeApplePreSessionEventPolicy.lower(value)
1733
+ }
1734
+
1735
+
1736
+ public struct AppleQosSnapshot: Equatable, Hashable {
1737
+ public var throughput: Double?
1738
+ public var fps: Double?
1739
+ public var latency: Double?
1740
+ public var playrate: Double?
1741
+ public var droppedFrames: UInt64?
1742
+ public var totalBytes: Int64?
1743
+ public var packetLoss: UInt64?
1744
+ public var packetSent: UInt64?
1745
+ public var droppedPackets: UInt64?
1746
+ public var lostPackets: UInt64?
1747
+ public var multicastAffectionTimeMs: UInt64?
1748
+
1749
+ // Default memberwise initializers are never public by default, so we
1750
+ // declare one manually.
1751
+ public init(throughput: Double?, fps: Double?, latency: Double?, playrate: Double?, droppedFrames: UInt64?, totalBytes: Int64?, packetLoss: UInt64?, packetSent: UInt64?, droppedPackets: UInt64?, lostPackets: UInt64?, multicastAffectionTimeMs: UInt64?) {
1752
+ self.throughput = throughput
1753
+ self.fps = fps
1754
+ self.latency = latency
1755
+ self.playrate = playrate
1756
+ self.droppedFrames = droppedFrames
1757
+ self.totalBytes = totalBytes
1758
+ self.packetLoss = packetLoss
1759
+ self.packetSent = packetSent
1760
+ self.droppedPackets = droppedPackets
1761
+ self.lostPackets = lostPackets
1762
+ self.multicastAffectionTimeMs = multicastAffectionTimeMs
1763
+ }
1764
+
1765
+
1766
+
1767
+
1768
+ }
1769
+
1770
+ #if compiler(>=6)
1771
+ extension AppleQosSnapshot: Sendable {}
1772
+ #endif
1773
+
1774
+ #if swift(>=5.8)
1775
+ @_documentation(visibility: private)
1776
+ #endif
1777
+ public struct FfiConverterTypeAppleQosSnapshot: FfiConverterRustBuffer {
1778
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppleQosSnapshot {
1779
+ return
1780
+ try AppleQosSnapshot(
1781
+ throughput: FfiConverterOptionDouble.read(from: &buf),
1782
+ fps: FfiConverterOptionDouble.read(from: &buf),
1783
+ latency: FfiConverterOptionDouble.read(from: &buf),
1784
+ playrate: FfiConverterOptionDouble.read(from: &buf),
1785
+ droppedFrames: FfiConverterOptionUInt64.read(from: &buf),
1786
+ totalBytes: FfiConverterOptionInt64.read(from: &buf),
1787
+ packetLoss: FfiConverterOptionUInt64.read(from: &buf),
1788
+ packetSent: FfiConverterOptionUInt64.read(from: &buf),
1789
+ droppedPackets: FfiConverterOptionUInt64.read(from: &buf),
1790
+ lostPackets: FfiConverterOptionUInt64.read(from: &buf),
1791
+ multicastAffectionTimeMs: FfiConverterOptionUInt64.read(from: &buf)
1792
+ )
1793
+ }
1794
+
1795
+ public static func write(_ value: AppleQosSnapshot, into buf: inout [UInt8]) {
1796
+ FfiConverterOptionDouble.write(value.throughput, into: &buf)
1797
+ FfiConverterOptionDouble.write(value.fps, into: &buf)
1798
+ FfiConverterOptionDouble.write(value.latency, into: &buf)
1799
+ FfiConverterOptionDouble.write(value.playrate, into: &buf)
1800
+ FfiConverterOptionUInt64.write(value.droppedFrames, into: &buf)
1801
+ FfiConverterOptionInt64.write(value.totalBytes, into: &buf)
1802
+ FfiConverterOptionUInt64.write(value.packetLoss, into: &buf)
1803
+ FfiConverterOptionUInt64.write(value.packetSent, into: &buf)
1804
+ FfiConverterOptionUInt64.write(value.droppedPackets, into: &buf)
1805
+ FfiConverterOptionUInt64.write(value.lostPackets, into: &buf)
1806
+ FfiConverterOptionUInt64.write(value.multicastAffectionTimeMs, into: &buf)
1807
+ }
1808
+ }
1809
+
1810
+
1811
+ #if swift(>=5.8)
1812
+ @_documentation(visibility: private)
1813
+ #endif
1814
+ public func FfiConverterTypeAppleQosSnapshot_lift(_ buf: RustBuffer) throws -> AppleQosSnapshot {
1815
+ return try FfiConverterTypeAppleQosSnapshot.lift(buf)
1816
+ }
1817
+
1818
+ #if swift(>=5.8)
1819
+ @_documentation(visibility: private)
1820
+ #endif
1821
+ public func FfiConverterTypeAppleQosSnapshot_lower(_ value: AppleQosSnapshot) -> RustBuffer {
1822
+ return FfiConverterTypeAppleQosSnapshot.lower(value)
1823
+ }
1824
+
1825
+
1826
+ public struct AppleRenderedLog: Equatable, Hashable {
1827
+ public var level: String
1828
+ public var tag: String
1829
+ public var message: String
1830
+
1831
+ // Default memberwise initializers are never public by default, so we
1832
+ // declare one manually.
1833
+ public init(level: String, tag: String, message: String) {
1834
+ self.level = level
1835
+ self.tag = tag
1836
+ self.message = message
1837
+ }
1838
+
1839
+
1840
+
1841
+
1842
+ }
1843
+
1844
+ #if compiler(>=6)
1845
+ extension AppleRenderedLog: Sendable {}
1846
+ #endif
1847
+
1848
+ #if swift(>=5.8)
1849
+ @_documentation(visibility: private)
1850
+ #endif
1851
+ public struct FfiConverterTypeAppleRenderedLog: FfiConverterRustBuffer {
1852
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppleRenderedLog {
1853
+ return
1854
+ try AppleRenderedLog(
1855
+ level: FfiConverterString.read(from: &buf),
1856
+ tag: FfiConverterString.read(from: &buf),
1857
+ message: FfiConverterString.read(from: &buf)
1858
+ )
1859
+ }
1860
+
1861
+ public static func write(_ value: AppleRenderedLog, into buf: inout [UInt8]) {
1862
+ FfiConverterString.write(value.level, into: &buf)
1863
+ FfiConverterString.write(value.tag, into: &buf)
1864
+ FfiConverterString.write(value.message, into: &buf)
1865
+ }
1866
+ }
1867
+
1868
+
1869
+ #if swift(>=5.8)
1870
+ @_documentation(visibility: private)
1871
+ #endif
1872
+ public func FfiConverterTypeAppleRenderedLog_lift(_ buf: RustBuffer) throws -> AppleRenderedLog {
1873
+ return try FfiConverterTypeAppleRenderedLog.lift(buf)
1874
+ }
1875
+
1876
+ #if swift(>=5.8)
1877
+ @_documentation(visibility: private)
1878
+ #endif
1879
+ public func FfiConverterTypeAppleRenderedLog_lower(_ value: AppleRenderedLog) -> RustBuffer {
1880
+ return FfiConverterTypeAppleRenderedLog.lower(value)
1881
+ }
1882
+
1883
+
1884
+ public struct AppleRuntimeConfig: Equatable, Hashable {
1885
+ public var accountCode: String
1886
+ public var pluginVersion: String
1887
+ public var appName: String
1888
+ public var buildVariant: String
1889
+ public var appReleaseVersion: String?
1890
+ public var lmaEndpoint: String
1891
+ public var analyticsUserAgent: String?
1892
+ public var allowLocalHttp: Bool
1893
+ public var logLevel: String
1894
+ public var preSessionEventPolicy: ApplePreSessionEventPolicy
1895
+
1896
+ // Default memberwise initializers are never public by default, so we
1897
+ // declare one manually.
1898
+ public init(accountCode: String, pluginVersion: String, appName: String, buildVariant: String, appReleaseVersion: String?, lmaEndpoint: String, analyticsUserAgent: String?, allowLocalHttp: Bool, logLevel: String, preSessionEventPolicy: ApplePreSessionEventPolicy) {
1899
+ self.accountCode = accountCode
1900
+ self.pluginVersion = pluginVersion
1901
+ self.appName = appName
1902
+ self.buildVariant = buildVariant
1903
+ self.appReleaseVersion = appReleaseVersion
1904
+ self.lmaEndpoint = lmaEndpoint
1905
+ self.analyticsUserAgent = analyticsUserAgent
1906
+ self.allowLocalHttp = allowLocalHttp
1907
+ self.logLevel = logLevel
1908
+ self.preSessionEventPolicy = preSessionEventPolicy
1909
+ }
1910
+
1911
+
1912
+
1913
+
1914
+ }
1915
+
1916
+ #if compiler(>=6)
1917
+ extension AppleRuntimeConfig: Sendable {}
1918
+ #endif
1919
+
1920
+ #if swift(>=5.8)
1921
+ @_documentation(visibility: private)
1922
+ #endif
1923
+ public struct FfiConverterTypeAppleRuntimeConfig: FfiConverterRustBuffer {
1924
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppleRuntimeConfig {
1925
+ return
1926
+ try AppleRuntimeConfig(
1927
+ accountCode: FfiConverterString.read(from: &buf),
1928
+ pluginVersion: FfiConverterString.read(from: &buf),
1929
+ appName: FfiConverterString.read(from: &buf),
1930
+ buildVariant: FfiConverterString.read(from: &buf),
1931
+ appReleaseVersion: FfiConverterOptionString.read(from: &buf),
1932
+ lmaEndpoint: FfiConverterString.read(from: &buf),
1933
+ analyticsUserAgent: FfiConverterOptionString.read(from: &buf),
1934
+ allowLocalHttp: FfiConverterBool.read(from: &buf),
1935
+ logLevel: FfiConverterString.read(from: &buf),
1936
+ preSessionEventPolicy: FfiConverterTypeApplePreSessionEventPolicy.read(from: &buf)
1937
+ )
1938
+ }
1939
+
1940
+ public static func write(_ value: AppleRuntimeConfig, into buf: inout [UInt8]) {
1941
+ FfiConverterString.write(value.accountCode, into: &buf)
1942
+ FfiConverterString.write(value.pluginVersion, into: &buf)
1943
+ FfiConverterString.write(value.appName, into: &buf)
1944
+ FfiConverterString.write(value.buildVariant, into: &buf)
1945
+ FfiConverterOptionString.write(value.appReleaseVersion, into: &buf)
1946
+ FfiConverterString.write(value.lmaEndpoint, into: &buf)
1947
+ FfiConverterOptionString.write(value.analyticsUserAgent, into: &buf)
1948
+ FfiConverterBool.write(value.allowLocalHttp, into: &buf)
1949
+ FfiConverterString.write(value.logLevel, into: &buf)
1950
+ FfiConverterTypeApplePreSessionEventPolicy.write(value.preSessionEventPolicy, into: &buf)
1951
+ }
1952
+ }
1953
+
1954
+
1955
+ #if swift(>=5.8)
1956
+ @_documentation(visibility: private)
1957
+ #endif
1958
+ public func FfiConverterTypeAppleRuntimeConfig_lift(_ buf: RustBuffer) throws -> AppleRuntimeConfig {
1959
+ return try FfiConverterTypeAppleRuntimeConfig.lift(buf)
1960
+ }
1961
+
1962
+ #if swift(>=5.8)
1963
+ @_documentation(visibility: private)
1964
+ #endif
1965
+ public func FfiConverterTypeAppleRuntimeConfig_lower(_ value: AppleRuntimeConfig) -> RustBuffer {
1966
+ return FfiConverterTypeAppleRuntimeConfig.lower(value)
1967
+ }
1968
+
1969
+
1970
+ public struct AppleRuntimeEventSnapshot: Equatable, Hashable {
1971
+ public var eventName: String
1972
+ public var timemarkMs: UInt64
1973
+ public var viewId: UInt64?
1974
+ public var payload: [String: String]
1975
+ public var outcome: AppleBindingOutcome
1976
+ public var destination: String?
1977
+ public var dispatchSource: String
1978
+ public var replay: Bool
1979
+ public var renderedLog: AppleRenderedLog?
1980
+
1981
+ // Default memberwise initializers are never public by default, so we
1982
+ // declare one manually.
1983
+ public init(eventName: String, timemarkMs: UInt64, viewId: UInt64?, payload: [String: String], outcome: AppleBindingOutcome, destination: String?, dispatchSource: String, replay: Bool, renderedLog: AppleRenderedLog?) {
1984
+ self.eventName = eventName
1985
+ self.timemarkMs = timemarkMs
1986
+ self.viewId = viewId
1987
+ self.payload = payload
1988
+ self.outcome = outcome
1989
+ self.destination = destination
1990
+ self.dispatchSource = dispatchSource
1991
+ self.replay = replay
1992
+ self.renderedLog = renderedLog
1993
+ }
1994
+
1995
+
1996
+
1997
+
1998
+ }
1999
+
2000
+ #if compiler(>=6)
2001
+ extension AppleRuntimeEventSnapshot: Sendable {}
2002
+ #endif
2003
+
2004
+ #if swift(>=5.8)
2005
+ @_documentation(visibility: private)
2006
+ #endif
2007
+ public struct FfiConverterTypeAppleRuntimeEventSnapshot: FfiConverterRustBuffer {
2008
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppleRuntimeEventSnapshot {
2009
+ return
2010
+ try AppleRuntimeEventSnapshot(
2011
+ eventName: FfiConverterString.read(from: &buf),
2012
+ timemarkMs: FfiConverterUInt64.read(from: &buf),
2013
+ viewId: FfiConverterOptionUInt64.read(from: &buf),
2014
+ payload: FfiConverterDictionaryStringString.read(from: &buf),
2015
+ outcome: FfiConverterTypeAppleBindingOutcome.read(from: &buf),
2016
+ destination: FfiConverterOptionString.read(from: &buf),
2017
+ dispatchSource: FfiConverterString.read(from: &buf),
2018
+ replay: FfiConverterBool.read(from: &buf),
2019
+ renderedLog: FfiConverterOptionTypeAppleRenderedLog.read(from: &buf)
2020
+ )
2021
+ }
2022
+
2023
+ public static func write(_ value: AppleRuntimeEventSnapshot, into buf: inout [UInt8]) {
2024
+ FfiConverterString.write(value.eventName, into: &buf)
2025
+ FfiConverterUInt64.write(value.timemarkMs, into: &buf)
2026
+ FfiConverterOptionUInt64.write(value.viewId, into: &buf)
2027
+ FfiConverterDictionaryStringString.write(value.payload, into: &buf)
2028
+ FfiConverterTypeAppleBindingOutcome.write(value.outcome, into: &buf)
2029
+ FfiConverterOptionString.write(value.destination, into: &buf)
2030
+ FfiConverterString.write(value.dispatchSource, into: &buf)
2031
+ FfiConverterBool.write(value.replay, into: &buf)
2032
+ FfiConverterOptionTypeAppleRenderedLog.write(value.renderedLog, into: &buf)
2033
+ }
2034
+ }
2035
+
2036
+
2037
+ #if swift(>=5.8)
2038
+ @_documentation(visibility: private)
2039
+ #endif
2040
+ public func FfiConverterTypeAppleRuntimeEventSnapshot_lift(_ buf: RustBuffer) throws -> AppleRuntimeEventSnapshot {
2041
+ return try FfiConverterTypeAppleRuntimeEventSnapshot.lift(buf)
2042
+ }
2043
+
2044
+ #if swift(>=5.8)
2045
+ @_documentation(visibility: private)
2046
+ #endif
2047
+ public func FfiConverterTypeAppleRuntimeEventSnapshot_lower(_ value: AppleRuntimeEventSnapshot) -> RustBuffer {
2048
+ return FfiConverterTypeAppleRuntimeEventSnapshot.lower(value)
2049
+ }
2050
+
2051
+
2052
+ public struct AppleSemanticTimestamp: Equatable, Hashable {
2053
+ public var timemarkMs: UInt64
2054
+ public var elapsedRealtimeMs: UInt64
2055
+
2056
+ // Default memberwise initializers are never public by default, so we
2057
+ // declare one manually.
2058
+ public init(timemarkMs: UInt64, elapsedRealtimeMs: UInt64) {
2059
+ self.timemarkMs = timemarkMs
2060
+ self.elapsedRealtimeMs = elapsedRealtimeMs
2061
+ }
2062
+
2063
+
2064
+
2065
+
2066
+ }
2067
+
2068
+ #if compiler(>=6)
2069
+ extension AppleSemanticTimestamp: Sendable {}
2070
+ #endif
2071
+
2072
+ #if swift(>=5.8)
2073
+ @_documentation(visibility: private)
2074
+ #endif
2075
+ public struct FfiConverterTypeAppleSemanticTimestamp: FfiConverterRustBuffer {
2076
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppleSemanticTimestamp {
2077
+ return
2078
+ try AppleSemanticTimestamp(
2079
+ timemarkMs: FfiConverterUInt64.read(from: &buf),
2080
+ elapsedRealtimeMs: FfiConverterUInt64.read(from: &buf)
2081
+ )
2082
+ }
2083
+
2084
+ public static func write(_ value: AppleSemanticTimestamp, into buf: inout [UInt8]) {
2085
+ FfiConverterUInt64.write(value.timemarkMs, into: &buf)
2086
+ FfiConverterUInt64.write(value.elapsedRealtimeMs, into: &buf)
2087
+ }
2088
+ }
2089
+
2090
+
2091
+ #if swift(>=5.8)
2092
+ @_documentation(visibility: private)
2093
+ #endif
2094
+ public func FfiConverterTypeAppleSemanticTimestamp_lift(_ buf: RustBuffer) throws -> AppleSemanticTimestamp {
2095
+ return try FfiConverterTypeAppleSemanticTimestamp.lift(buf)
2096
+ }
2097
+
2098
+ #if swift(>=5.8)
2099
+ @_documentation(visibility: private)
2100
+ #endif
2101
+ public func FfiConverterTypeAppleSemanticTimestamp_lower(_ value: AppleSemanticTimestamp) -> RustBuffer {
2102
+ return FfiConverterTypeAppleSemanticTimestamp.lower(value)
2103
+ }
2104
+
2105
+
2106
+ public struct AppleVideoOptions: Equatable, Hashable {
2107
+ public var joinTimeCalculationMode: String?
2108
+ public var adJoinFromAdBreakStart: Bool?
2109
+ public var adConnectedRequiresAdJoin: Bool?
2110
+ public var contentIsLiveNoSeek: Bool?
2111
+ public var ignorePauseSmallEvents: Bool?
2112
+
2113
+ // Default memberwise initializers are never public by default, so we
2114
+ // declare one manually.
2115
+ public init(joinTimeCalculationMode: String?, adJoinFromAdBreakStart: Bool?, adConnectedRequiresAdJoin: Bool?, contentIsLiveNoSeek: Bool?, ignorePauseSmallEvents: Bool?) {
2116
+ self.joinTimeCalculationMode = joinTimeCalculationMode
2117
+ self.adJoinFromAdBreakStart = adJoinFromAdBreakStart
2118
+ self.adConnectedRequiresAdJoin = adConnectedRequiresAdJoin
2119
+ self.contentIsLiveNoSeek = contentIsLiveNoSeek
2120
+ self.ignorePauseSmallEvents = ignorePauseSmallEvents
2121
+ }
2122
+
2123
+
2124
+
2125
+
2126
+ }
2127
+
2128
+ #if compiler(>=6)
2129
+ extension AppleVideoOptions: Sendable {}
2130
+ #endif
2131
+
2132
+ #if swift(>=5.8)
2133
+ @_documentation(visibility: private)
2134
+ #endif
2135
+ public struct FfiConverterTypeAppleVideoOptions: FfiConverterRustBuffer {
2136
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppleVideoOptions {
2137
+ return
2138
+ try AppleVideoOptions(
2139
+ joinTimeCalculationMode: FfiConverterOptionString.read(from: &buf),
2140
+ adJoinFromAdBreakStart: FfiConverterOptionBool.read(from: &buf),
2141
+ adConnectedRequiresAdJoin: FfiConverterOptionBool.read(from: &buf),
2142
+ contentIsLiveNoSeek: FfiConverterOptionBool.read(from: &buf),
2143
+ ignorePauseSmallEvents: FfiConverterOptionBool.read(from: &buf)
2144
+ )
2145
+ }
2146
+
2147
+ public static func write(_ value: AppleVideoOptions, into buf: inout [UInt8]) {
2148
+ FfiConverterOptionString.write(value.joinTimeCalculationMode, into: &buf)
2149
+ FfiConverterOptionBool.write(value.adJoinFromAdBreakStart, into: &buf)
2150
+ FfiConverterOptionBool.write(value.adConnectedRequiresAdJoin, into: &buf)
2151
+ FfiConverterOptionBool.write(value.contentIsLiveNoSeek, into: &buf)
2152
+ FfiConverterOptionBool.write(value.ignorePauseSmallEvents, into: &buf)
2153
+ }
2154
+ }
2155
+
2156
+
2157
+ #if swift(>=5.8)
2158
+ @_documentation(visibility: private)
2159
+ #endif
2160
+ public func FfiConverterTypeAppleVideoOptions_lift(_ buf: RustBuffer) throws -> AppleVideoOptions {
2161
+ return try FfiConverterTypeAppleVideoOptions.lift(buf)
2162
+ }
2163
+
2164
+ #if swift(>=5.8)
2165
+ @_documentation(visibility: private)
2166
+ #endif
2167
+ public func FfiConverterTypeAppleVideoOptions_lower(_ value: AppleVideoOptions) -> RustBuffer {
2168
+ return FfiConverterTypeAppleVideoOptions.lower(value)
2169
+ }
2170
+
2171
+ // Note that we don't yet support `indirect` for enums.
2172
+ // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
2173
+
2174
+ public enum AppleAdEvent: Equatable, Hashable {
2175
+
2176
+ case manifest
2177
+ case breakStart
2178
+ case `init`
2179
+ case start
2180
+ case join
2181
+ case pause
2182
+ case resume
2183
+ case bufferBegin
2184
+ case bufferEnd
2185
+ case quartile
2186
+ case click
2187
+ case skip
2188
+ case stop
2189
+ case error
2190
+ case fatalError
2191
+ case breakStop
2192
+
2193
+
2194
+
2195
+
2196
+
2197
+ }
2198
+
2199
+ #if compiler(>=6)
2200
+ extension AppleAdEvent: Sendable {}
2201
+ #endif
2202
+
2203
+ #if swift(>=5.8)
2204
+ @_documentation(visibility: private)
2205
+ #endif
2206
+ public struct FfiConverterTypeAppleAdEvent: FfiConverterRustBuffer {
2207
+ typealias SwiftType = AppleAdEvent
2208
+
2209
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppleAdEvent {
2210
+ let variant: Int32 = try readInt(&buf)
2211
+ switch variant {
2212
+
2213
+ case 1: return .manifest
2214
+
2215
+ case 2: return .breakStart
2216
+
2217
+ case 3: return .`init`
2218
+
2219
+ case 4: return .start
2220
+
2221
+ case 5: return .join
2222
+
2223
+ case 6: return .pause
2224
+
2225
+ case 7: return .resume
2226
+
2227
+ case 8: return .bufferBegin
2228
+
2229
+ case 9: return .bufferEnd
2230
+
2231
+ case 10: return .quartile
2232
+
2233
+ case 11: return .click
2234
+
2235
+ case 12: return .skip
2236
+
2237
+ case 13: return .stop
2238
+
2239
+ case 14: return .error
2240
+
2241
+ case 15: return .fatalError
2242
+
2243
+ case 16: return .breakStop
2244
+
2245
+ default: throw UniffiInternalError.unexpectedEnumCase
2246
+ }
2247
+ }
2248
+
2249
+ public static func write(_ value: AppleAdEvent, into buf: inout [UInt8]) {
2250
+ switch value {
2251
+
2252
+
2253
+ case .manifest:
2254
+ writeInt(&buf, Int32(1))
2255
+
2256
+
2257
+ case .breakStart:
2258
+ writeInt(&buf, Int32(2))
2259
+
2260
+
2261
+ case .`init`:
2262
+ writeInt(&buf, Int32(3))
2263
+
2264
+
2265
+ case .start:
2266
+ writeInt(&buf, Int32(4))
2267
+
2268
+
2269
+ case .join:
2270
+ writeInt(&buf, Int32(5))
2271
+
2272
+
2273
+ case .pause:
2274
+ writeInt(&buf, Int32(6))
2275
+
2276
+
2277
+ case .resume:
2278
+ writeInt(&buf, Int32(7))
2279
+
2280
+
2281
+ case .bufferBegin:
2282
+ writeInt(&buf, Int32(8))
2283
+
2284
+
2285
+ case .bufferEnd:
2286
+ writeInt(&buf, Int32(9))
2287
+
2288
+
2289
+ case .quartile:
2290
+ writeInt(&buf, Int32(10))
2291
+
2292
+
2293
+ case .click:
2294
+ writeInt(&buf, Int32(11))
2295
+
2296
+
2297
+ case .skip:
2298
+ writeInt(&buf, Int32(12))
2299
+
2300
+
2301
+ case .stop:
2302
+ writeInt(&buf, Int32(13))
2303
+
2304
+
2305
+ case .error:
2306
+ writeInt(&buf, Int32(14))
2307
+
2308
+
2309
+ case .fatalError:
2310
+ writeInt(&buf, Int32(15))
2311
+
2312
+
2313
+ case .breakStop:
2314
+ writeInt(&buf, Int32(16))
2315
+
2316
+ }
2317
+ }
2318
+ }
2319
+
2320
+
2321
+ #if swift(>=5.8)
2322
+ @_documentation(visibility: private)
2323
+ #endif
2324
+ public func FfiConverterTypeAppleAdEvent_lift(_ buf: RustBuffer) throws -> AppleAdEvent {
2325
+ return try FfiConverterTypeAppleAdEvent.lift(buf)
2326
+ }
2327
+
2328
+ #if swift(>=5.8)
2329
+ @_documentation(visibility: private)
2330
+ #endif
2331
+ public func FfiConverterTypeAppleAdEvent_lower(_ value: AppleAdEvent) -> RustBuffer {
2332
+ return FfiConverterTypeAppleAdEvent.lower(value)
2333
+ }
2334
+
2335
+
2336
+ // Note that we don't yet support `indirect` for enums.
2337
+ // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
2338
+
2339
+ public enum AppleAdInsertionType: Equatable, Hashable {
2340
+
2341
+ case clientSide
2342
+ case serverSide
2343
+ case unknown
2344
+
2345
+
2346
+
2347
+
2348
+
2349
+ }
2350
+
2351
+ #if compiler(>=6)
2352
+ extension AppleAdInsertionType: Sendable {}
2353
+ #endif
2354
+
2355
+ #if swift(>=5.8)
2356
+ @_documentation(visibility: private)
2357
+ #endif
2358
+ public struct FfiConverterTypeAppleAdInsertionType: FfiConverterRustBuffer {
2359
+ typealias SwiftType = AppleAdInsertionType
2360
+
2361
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppleAdInsertionType {
2362
+ let variant: Int32 = try readInt(&buf)
2363
+ switch variant {
2364
+
2365
+ case 1: return .clientSide
2366
+
2367
+ case 2: return .serverSide
2368
+
2369
+ case 3: return .unknown
2370
+
2371
+ default: throw UniffiInternalError.unexpectedEnumCase
2372
+ }
2373
+ }
2374
+
2375
+ public static func write(_ value: AppleAdInsertionType, into buf: inout [UInt8]) {
2376
+ switch value {
2377
+
2378
+
2379
+ case .clientSide:
2380
+ writeInt(&buf, Int32(1))
2381
+
2382
+
2383
+ case .serverSide:
2384
+ writeInt(&buf, Int32(2))
2385
+
2386
+
2387
+ case .unknown:
2388
+ writeInt(&buf, Int32(3))
2389
+
2390
+ }
2391
+ }
2392
+ }
2393
+
2394
+
2395
+ #if swift(>=5.8)
2396
+ @_documentation(visibility: private)
2397
+ #endif
2398
+ public func FfiConverterTypeAppleAdInsertionType_lift(_ buf: RustBuffer) throws -> AppleAdInsertionType {
2399
+ return try FfiConverterTypeAppleAdInsertionType.lift(buf)
2400
+ }
2401
+
2402
+ #if swift(>=5.8)
2403
+ @_documentation(visibility: private)
2404
+ #endif
2405
+ public func FfiConverterTypeAppleAdInsertionType_lower(_ value: AppleAdInsertionType) -> RustBuffer {
2406
+ return FfiConverterTypeAppleAdInsertionType.lower(value)
2407
+ }
2408
+
2409
+
2410
+ // Note that we don't yet support `indirect` for enums.
2411
+ // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
2412
+
2413
+ public enum AppleAdPosition: Equatable, Hashable {
2414
+
2415
+ case pre
2416
+ case mid
2417
+ case post
2418
+ case unknown
2419
+
2420
+
2421
+
2422
+
2423
+
2424
+ }
2425
+
2426
+ #if compiler(>=6)
2427
+ extension AppleAdPosition: Sendable {}
2428
+ #endif
2429
+
2430
+ #if swift(>=5.8)
2431
+ @_documentation(visibility: private)
2432
+ #endif
2433
+ public struct FfiConverterTypeAppleAdPosition: FfiConverterRustBuffer {
2434
+ typealias SwiftType = AppleAdPosition
2435
+
2436
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppleAdPosition {
2437
+ let variant: Int32 = try readInt(&buf)
2438
+ switch variant {
2439
+
2440
+ case 1: return .pre
2441
+
2442
+ case 2: return .mid
2443
+
2444
+ case 3: return .post
2445
+
2446
+ case 4: return .unknown
2447
+
2448
+ default: throw UniffiInternalError.unexpectedEnumCase
2449
+ }
2450
+ }
2451
+
2452
+ public static func write(_ value: AppleAdPosition, into buf: inout [UInt8]) {
2453
+ switch value {
2454
+
2455
+
2456
+ case .pre:
2457
+ writeInt(&buf, Int32(1))
2458
+
2459
+
2460
+ case .mid:
2461
+ writeInt(&buf, Int32(2))
2462
+
2463
+
2464
+ case .post:
2465
+ writeInt(&buf, Int32(3))
2466
+
2467
+
2468
+ case .unknown:
2469
+ writeInt(&buf, Int32(4))
2470
+
2471
+ }
2472
+ }
2473
+ }
2474
+
2475
+
2476
+ #if swift(>=5.8)
2477
+ @_documentation(visibility: private)
2478
+ #endif
2479
+ public func FfiConverterTypeAppleAdPosition_lift(_ buf: RustBuffer) throws -> AppleAdPosition {
2480
+ return try FfiConverterTypeAppleAdPosition.lift(buf)
2481
+ }
2482
+
2483
+ #if swift(>=5.8)
2484
+ @_documentation(visibility: private)
2485
+ #endif
2486
+ public func FfiConverterTypeAppleAdPosition_lower(_ value: AppleAdPosition) -> RustBuffer {
2487
+ return FfiConverterTypeAppleAdPosition.lower(value)
2488
+ }
2489
+
2490
+
2491
+ // Note that we don't yet support `indirect` for enums.
2492
+ // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
2493
+
2494
+ public enum AppleBindingStatus: Equatable, Hashable {
2495
+
2496
+ case accepted
2497
+ case deferred
2498
+ case dropped
2499
+ case ignoredDuplicate
2500
+ case ignoredBeforeSessionStart
2501
+ case ignoredInvalidState
2502
+ case failedWithDiagnostic
2503
+
2504
+
2505
+
2506
+
2507
+
2508
+ }
2509
+
2510
+ #if compiler(>=6)
2511
+ extension AppleBindingStatus: Sendable {}
2512
+ #endif
2513
+
2514
+ #if swift(>=5.8)
2515
+ @_documentation(visibility: private)
2516
+ #endif
2517
+ public struct FfiConverterTypeAppleBindingStatus: FfiConverterRustBuffer {
2518
+ typealias SwiftType = AppleBindingStatus
2519
+
2520
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppleBindingStatus {
2521
+ let variant: Int32 = try readInt(&buf)
2522
+ switch variant {
2523
+
2524
+ case 1: return .accepted
2525
+
2526
+ case 2: return .deferred
2527
+
2528
+ case 3: return .dropped
2529
+
2530
+ case 4: return .ignoredDuplicate
2531
+
2532
+ case 5: return .ignoredBeforeSessionStart
2533
+
2534
+ case 6: return .ignoredInvalidState
2535
+
2536
+ case 7: return .failedWithDiagnostic
2537
+
2538
+ default: throw UniffiInternalError.unexpectedEnumCase
2539
+ }
2540
+ }
2541
+
2542
+ public static func write(_ value: AppleBindingStatus, into buf: inout [UInt8]) {
2543
+ switch value {
2544
+
2545
+
2546
+ case .accepted:
2547
+ writeInt(&buf, Int32(1))
2548
+
2549
+
2550
+ case .deferred:
2551
+ writeInt(&buf, Int32(2))
2552
+
2553
+
2554
+ case .dropped:
2555
+ writeInt(&buf, Int32(3))
2556
+
2557
+
2558
+ case .ignoredDuplicate:
2559
+ writeInt(&buf, Int32(4))
2560
+
2561
+
2562
+ case .ignoredBeforeSessionStart:
2563
+ writeInt(&buf, Int32(5))
2564
+
2565
+
2566
+ case .ignoredInvalidState:
2567
+ writeInt(&buf, Int32(6))
2568
+
2569
+
2570
+ case .failedWithDiagnostic:
2571
+ writeInt(&buf, Int32(7))
2572
+
2573
+ }
2574
+ }
2575
+ }
2576
+
2577
+
2578
+ #if swift(>=5.8)
2579
+ @_documentation(visibility: private)
2580
+ #endif
2581
+ public func FfiConverterTypeAppleBindingStatus_lift(_ buf: RustBuffer) throws -> AppleBindingStatus {
2582
+ return try FfiConverterTypeAppleBindingStatus.lift(buf)
2583
+ }
2584
+
2585
+ #if swift(>=5.8)
2586
+ @_documentation(visibility: private)
2587
+ #endif
2588
+ public func FfiConverterTypeAppleBindingStatus_lower(_ value: AppleBindingStatus) -> RustBuffer {
2589
+ return FfiConverterTypeAppleBindingStatus.lower(value)
2590
+ }
2591
+
2592
+
2593
+ // Note that we don't yet support `indirect` for enums.
2594
+ // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
2595
+
2596
+ public enum AppleContentType: Equatable, Hashable {
2597
+
2598
+ case live
2599
+ case vod
2600
+ case audio
2601
+ case unknown
2602
+
2603
+
2604
+
2605
+
2606
+
2607
+ }
2608
+
2609
+ #if compiler(>=6)
2610
+ extension AppleContentType: Sendable {}
2611
+ #endif
2612
+
2613
+ #if swift(>=5.8)
2614
+ @_documentation(visibility: private)
2615
+ #endif
2616
+ public struct FfiConverterTypeAppleContentType: FfiConverterRustBuffer {
2617
+ typealias SwiftType = AppleContentType
2618
+
2619
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppleContentType {
2620
+ let variant: Int32 = try readInt(&buf)
2621
+ switch variant {
2622
+
2623
+ case 1: return .live
2624
+
2625
+ case 2: return .vod
2626
+
2627
+ case 3: return .audio
2628
+
2629
+ case 4: return .unknown
2630
+
2631
+ default: throw UniffiInternalError.unexpectedEnumCase
2632
+ }
2633
+ }
2634
+
2635
+ public static func write(_ value: AppleContentType, into buf: inout [UInt8]) {
2636
+ switch value {
2637
+
2638
+
2639
+ case .live:
2640
+ writeInt(&buf, Int32(1))
2641
+
2642
+
2643
+ case .vod:
2644
+ writeInt(&buf, Int32(2))
2645
+
2646
+
2647
+ case .audio:
2648
+ writeInt(&buf, Int32(3))
2649
+
2650
+
2651
+ case .unknown:
2652
+ writeInt(&buf, Int32(4))
2653
+
2654
+ }
2655
+ }
2656
+ }
2657
+
2658
+
2659
+ #if swift(>=5.8)
2660
+ @_documentation(visibility: private)
2661
+ #endif
2662
+ public func FfiConverterTypeAppleContentType_lift(_ buf: RustBuffer) throws -> AppleContentType {
2663
+ return try FfiConverterTypeAppleContentType.lift(buf)
2664
+ }
2665
+
2666
+ #if swift(>=5.8)
2667
+ @_documentation(visibility: private)
2668
+ #endif
2669
+ public func FfiConverterTypeAppleContentType_lower(_ value: AppleContentType) -> RustBuffer {
2670
+ return FfiConverterTypeAppleContentType.lower(value)
2671
+ }
2672
+
2673
+
2674
+ // Note that we don't yet support `indirect` for enums.
2675
+ // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
2676
+
2677
+ public enum AppleVideoEvent: Equatable, Hashable {
2678
+
2679
+ case `init`
2680
+ case start
2681
+ case join
2682
+ case pause
2683
+ case resume
2684
+ case seekBegin
2685
+ case seekEnd
2686
+ case bufferBegin
2687
+ case bufferEnd
2688
+ case stop
2689
+ case error
2690
+ case fatalError
2691
+ case destroy
2692
+ case custom
2693
+ case customEnd
2694
+ case metadataUpdate
2695
+
2696
+
2697
+
2698
+
2699
+
2700
+ }
2701
+
2702
+ #if compiler(>=6)
2703
+ extension AppleVideoEvent: Sendable {}
2704
+ #endif
2705
+
2706
+ #if swift(>=5.8)
2707
+ @_documentation(visibility: private)
2708
+ #endif
2709
+ public struct FfiConverterTypeAppleVideoEvent: FfiConverterRustBuffer {
2710
+ typealias SwiftType = AppleVideoEvent
2711
+
2712
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> AppleVideoEvent {
2713
+ let variant: Int32 = try readInt(&buf)
2714
+ switch variant {
2715
+
2716
+ case 1: return .`init`
2717
+
2718
+ case 2: return .start
2719
+
2720
+ case 3: return .join
2721
+
2722
+ case 4: return .pause
2723
+
2724
+ case 5: return .resume
2725
+
2726
+ case 6: return .seekBegin
2727
+
2728
+ case 7: return .seekEnd
2729
+
2730
+ case 8: return .bufferBegin
2731
+
2732
+ case 9: return .bufferEnd
2733
+
2734
+ case 10: return .stop
2735
+
2736
+ case 11: return .error
2737
+
2738
+ case 12: return .fatalError
2739
+
2740
+ case 13: return .destroy
2741
+
2742
+ case 14: return .custom
2743
+
2744
+ case 15: return .customEnd
2745
+
2746
+ case 16: return .metadataUpdate
2747
+
2748
+ default: throw UniffiInternalError.unexpectedEnumCase
2749
+ }
2750
+ }
2751
+
2752
+ public static func write(_ value: AppleVideoEvent, into buf: inout [UInt8]) {
2753
+ switch value {
2754
+
2755
+
2756
+ case .`init`:
2757
+ writeInt(&buf, Int32(1))
2758
+
2759
+
2760
+ case .start:
2761
+ writeInt(&buf, Int32(2))
2762
+
2763
+
2764
+ case .join:
2765
+ writeInt(&buf, Int32(3))
2766
+
2767
+
2768
+ case .pause:
2769
+ writeInt(&buf, Int32(4))
2770
+
2771
+
2772
+ case .resume:
2773
+ writeInt(&buf, Int32(5))
2774
+
2775
+
2776
+ case .seekBegin:
2777
+ writeInt(&buf, Int32(6))
2778
+
2779
+
2780
+ case .seekEnd:
2781
+ writeInt(&buf, Int32(7))
2782
+
2783
+
2784
+ case .bufferBegin:
2785
+ writeInt(&buf, Int32(8))
2786
+
2787
+
2788
+ case .bufferEnd:
2789
+ writeInt(&buf, Int32(9))
2790
+
2791
+
2792
+ case .stop:
2793
+ writeInt(&buf, Int32(10))
2794
+
2795
+
2796
+ case .error:
2797
+ writeInt(&buf, Int32(11))
2798
+
2799
+
2800
+ case .fatalError:
2801
+ writeInt(&buf, Int32(12))
2802
+
2803
+
2804
+ case .destroy:
2805
+ writeInt(&buf, Int32(13))
2806
+
2807
+
2808
+ case .custom:
2809
+ writeInt(&buf, Int32(14))
2810
+
2811
+
2812
+ case .customEnd:
2813
+ writeInt(&buf, Int32(15))
2814
+
2815
+
2816
+ case .metadataUpdate:
2817
+ writeInt(&buf, Int32(16))
2818
+
2819
+ }
2820
+ }
2821
+ }
2822
+
2823
+
2824
+ #if swift(>=5.8)
2825
+ @_documentation(visibility: private)
2826
+ #endif
2827
+ public func FfiConverterTypeAppleVideoEvent_lift(_ buf: RustBuffer) throws -> AppleVideoEvent {
2828
+ return try FfiConverterTypeAppleVideoEvent.lift(buf)
2829
+ }
2830
+
2831
+ #if swift(>=5.8)
2832
+ @_documentation(visibility: private)
2833
+ #endif
2834
+ public func FfiConverterTypeAppleVideoEvent_lower(_ value: AppleVideoEvent) -> RustBuffer {
2835
+ return FfiConverterTypeAppleVideoEvent.lower(value)
2836
+ }
2837
+
2838
+
2839
+
2840
+
2841
+
2842
+ public protocol AppleCapturePlanListener: AnyObject, Sendable {
2843
+
2844
+ func onPlan(plan: AppleCapturePlan)
2845
+
2846
+ }
2847
+
2848
+
2849
+ // Put the implementation in a struct so we don't pollute the top-level namespace
2850
+ fileprivate struct UniffiCallbackInterfaceAppleCapturePlanListener {
2851
+
2852
+ // Create the VTable using a series of closures.
2853
+ // Swift automatically converts these into C callback functions.
2854
+ //
2855
+ // Store the vtable directly.
2856
+ static let vtable: UniffiVTableCallbackInterfaceAppleCapturePlanListener = UniffiVTableCallbackInterfaceAppleCapturePlanListener(
2857
+ uniffiFree: { (uniffiHandle: UInt64) -> () in
2858
+ do {
2859
+ try FfiConverterCallbackInterfaceAppleCapturePlanListener.handleMap.remove(handle: uniffiHandle)
2860
+ } catch {
2861
+ print("Uniffi callback interface AppleCapturePlanListener: handle missing in uniffiFree")
2862
+ }
2863
+ },
2864
+ uniffiClone: { (uniffiHandle: UInt64) -> UInt64 in
2865
+ do {
2866
+ return try FfiConverterCallbackInterfaceAppleCapturePlanListener.handleMap.clone(handle: uniffiHandle)
2867
+ } catch {
2868
+ fatalError("Uniffi callback interface AppleCapturePlanListener: handle missing in uniffiClone")
2869
+ }
2870
+ },
2871
+ onPlan: { (
2872
+ uniffiHandle: UInt64,
2873
+ plan: RustBuffer,
2874
+ uniffiOutReturn: UnsafeMutableRawPointer,
2875
+ uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
2876
+ ) in
2877
+ let makeCall = {
2878
+ () throws -> () in
2879
+ guard let uniffiObj = try? FfiConverterCallbackInterfaceAppleCapturePlanListener.handleMap.get(handle: uniffiHandle) else {
2880
+ throw UniffiInternalError.unexpectedStaleHandle
2881
+ }
2882
+ return uniffiObj.onPlan(
2883
+ plan: try FfiConverterTypeAppleCapturePlan_lift(plan)
2884
+ )
2885
+ }
2886
+
2887
+
2888
+ let writeReturn = { () }
2889
+ uniffiTraitInterfaceCall(
2890
+ callStatus: uniffiCallStatus,
2891
+ makeCall: makeCall,
2892
+ writeReturn: writeReturn
2893
+ )
2894
+ }
2895
+ )
2896
+
2897
+ // Rust stores this pointer for future callback invocations, so it must live
2898
+ // for the process lifetime (not just for the init function call).
2899
+ static let vtablePtr: UnsafePointer<UniffiVTableCallbackInterfaceAppleCapturePlanListener> = {
2900
+ let ptr = UnsafeMutablePointer<UniffiVTableCallbackInterfaceAppleCapturePlanListener>.allocate(capacity: 1)
2901
+ ptr.initialize(to: vtable)
2902
+ return UnsafePointer(ptr)
2903
+ }()
2904
+ }
2905
+
2906
+ private func uniffiCallbackInitAppleCapturePlanListener() {
2907
+ uniffi_forge_kernel_uniffi_fn_init_callback_vtable_applecaptureplanlistener(UniffiCallbackInterfaceAppleCapturePlanListener.vtablePtr)
2908
+ }
2909
+
2910
+ // FfiConverter protocol for callback interfaces
2911
+ #if swift(>=5.8)
2912
+ @_documentation(visibility: private)
2913
+ #endif
2914
+ fileprivate struct FfiConverterCallbackInterfaceAppleCapturePlanListener {
2915
+ fileprivate static let handleMap = UniffiHandleMap<AppleCapturePlanListener>()
2916
+ }
2917
+
2918
+ #if swift(>=5.8)
2919
+ @_documentation(visibility: private)
2920
+ #endif
2921
+ extension FfiConverterCallbackInterfaceAppleCapturePlanListener : FfiConverter {
2922
+ typealias SwiftType = AppleCapturePlanListener
2923
+ typealias FfiType = UInt64
2924
+
2925
+ #if swift(>=5.8)
2926
+ @_documentation(visibility: private)
2927
+ #endif
2928
+ public static func lift(_ handle: UInt64) throws -> SwiftType {
2929
+ try handleMap.get(handle: handle)
2930
+ }
2931
+
2932
+ #if swift(>=5.8)
2933
+ @_documentation(visibility: private)
2934
+ #endif
2935
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
2936
+ let handle: UInt64 = try readInt(&buf)
2937
+ return try lift(handle)
2938
+ }
2939
+
2940
+ #if swift(>=5.8)
2941
+ @_documentation(visibility: private)
2942
+ #endif
2943
+ public static func lower(_ v: SwiftType) -> UInt64 {
2944
+ return handleMap.insert(obj: v)
2945
+ }
2946
+
2947
+ #if swift(>=5.8)
2948
+ @_documentation(visibility: private)
2949
+ #endif
2950
+ public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
2951
+ writeInt(&buf, lower(v))
2952
+ }
2953
+ }
2954
+
2955
+
2956
+ #if swift(>=5.8)
2957
+ @_documentation(visibility: private)
2958
+ #endif
2959
+ public func FfiConverterCallbackInterfaceAppleCapturePlanListener_lift(_ handle: UInt64) throws -> AppleCapturePlanListener {
2960
+ return try FfiConverterCallbackInterfaceAppleCapturePlanListener.lift(handle)
2961
+ }
2962
+
2963
+ #if swift(>=5.8)
2964
+ @_documentation(visibility: private)
2965
+ #endif
2966
+ public func FfiConverterCallbackInterfaceAppleCapturePlanListener_lower(_ v: AppleCapturePlanListener) -> UInt64 {
2967
+ return FfiConverterCallbackInterfaceAppleCapturePlanListener.lower(v)
2968
+ }
2969
+
2970
+
2971
+
2972
+
2973
+ public protocol AppleContentMetadataProvider: AnyObject, Sendable {
2974
+
2975
+ func metadataSnapshot(viewId: UInt64, timestamp: AppleSemanticTimestamp) -> AppleMetadataSnapshot?
2976
+
2977
+ }
2978
+
2979
+
2980
+ // Put the implementation in a struct so we don't pollute the top-level namespace
2981
+ fileprivate struct UniffiCallbackInterfaceAppleContentMetadataProvider {
2982
+
2983
+ // Create the VTable using a series of closures.
2984
+ // Swift automatically converts these into C callback functions.
2985
+ //
2986
+ // Store the vtable directly.
2987
+ static let vtable: UniffiVTableCallbackInterfaceAppleContentMetadataProvider = UniffiVTableCallbackInterfaceAppleContentMetadataProvider(
2988
+ uniffiFree: { (uniffiHandle: UInt64) -> () in
2989
+ do {
2990
+ try FfiConverterCallbackInterfaceAppleContentMetadataProvider.handleMap.remove(handle: uniffiHandle)
2991
+ } catch {
2992
+ print("Uniffi callback interface AppleContentMetadataProvider: handle missing in uniffiFree")
2993
+ }
2994
+ },
2995
+ uniffiClone: { (uniffiHandle: UInt64) -> UInt64 in
2996
+ do {
2997
+ return try FfiConverterCallbackInterfaceAppleContentMetadataProvider.handleMap.clone(handle: uniffiHandle)
2998
+ } catch {
2999
+ fatalError("Uniffi callback interface AppleContentMetadataProvider: handle missing in uniffiClone")
3000
+ }
3001
+ },
3002
+ metadataSnapshot: { (
3003
+ uniffiHandle: UInt64,
3004
+ viewId: UInt64,
3005
+ timestamp: RustBuffer,
3006
+ uniffiOutReturn: UnsafeMutablePointer<RustBuffer>,
3007
+ uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
3008
+ ) in
3009
+ let makeCall = {
3010
+ () throws -> AppleMetadataSnapshot? in
3011
+ guard let uniffiObj = try? FfiConverterCallbackInterfaceAppleContentMetadataProvider.handleMap.get(handle: uniffiHandle) else {
3012
+ throw UniffiInternalError.unexpectedStaleHandle
3013
+ }
3014
+ return uniffiObj.metadataSnapshot(
3015
+ viewId: try FfiConverterUInt64.lift(viewId),
3016
+ timestamp: try FfiConverterTypeAppleSemanticTimestamp_lift(timestamp)
3017
+ )
3018
+ }
3019
+
3020
+
3021
+ let writeReturn = { uniffiOutReturn.pointee = FfiConverterOptionTypeAppleMetadataSnapshot.lower($0) }
3022
+ uniffiTraitInterfaceCall(
3023
+ callStatus: uniffiCallStatus,
3024
+ makeCall: makeCall,
3025
+ writeReturn: writeReturn
3026
+ )
3027
+ }
3028
+ )
3029
+
3030
+ // Rust stores this pointer for future callback invocations, so it must live
3031
+ // for the process lifetime (not just for the init function call).
3032
+ static let vtablePtr: UnsafePointer<UniffiVTableCallbackInterfaceAppleContentMetadataProvider> = {
3033
+ let ptr = UnsafeMutablePointer<UniffiVTableCallbackInterfaceAppleContentMetadataProvider>.allocate(capacity: 1)
3034
+ ptr.initialize(to: vtable)
3035
+ return UnsafePointer(ptr)
3036
+ }()
3037
+ }
3038
+
3039
+ private func uniffiCallbackInitAppleContentMetadataProvider() {
3040
+ uniffi_forge_kernel_uniffi_fn_init_callback_vtable_applecontentmetadataprovider(UniffiCallbackInterfaceAppleContentMetadataProvider.vtablePtr)
3041
+ }
3042
+
3043
+ // FfiConverter protocol for callback interfaces
3044
+ #if swift(>=5.8)
3045
+ @_documentation(visibility: private)
3046
+ #endif
3047
+ fileprivate struct FfiConverterCallbackInterfaceAppleContentMetadataProvider {
3048
+ fileprivate static let handleMap = UniffiHandleMap<AppleContentMetadataProvider>()
3049
+ }
3050
+
3051
+ #if swift(>=5.8)
3052
+ @_documentation(visibility: private)
3053
+ #endif
3054
+ extension FfiConverterCallbackInterfaceAppleContentMetadataProvider : FfiConverter {
3055
+ typealias SwiftType = AppleContentMetadataProvider
3056
+ typealias FfiType = UInt64
3057
+
3058
+ #if swift(>=5.8)
3059
+ @_documentation(visibility: private)
3060
+ #endif
3061
+ public static func lift(_ handle: UInt64) throws -> SwiftType {
3062
+ try handleMap.get(handle: handle)
3063
+ }
3064
+
3065
+ #if swift(>=5.8)
3066
+ @_documentation(visibility: private)
3067
+ #endif
3068
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
3069
+ let handle: UInt64 = try readInt(&buf)
3070
+ return try lift(handle)
3071
+ }
3072
+
3073
+ #if swift(>=5.8)
3074
+ @_documentation(visibility: private)
3075
+ #endif
3076
+ public static func lower(_ v: SwiftType) -> UInt64 {
3077
+ return handleMap.insert(obj: v)
3078
+ }
3079
+
3080
+ #if swift(>=5.8)
3081
+ @_documentation(visibility: private)
3082
+ #endif
3083
+ public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
3084
+ writeInt(&buf, lower(v))
3085
+ }
3086
+ }
3087
+
3088
+
3089
+ #if swift(>=5.8)
3090
+ @_documentation(visibility: private)
3091
+ #endif
3092
+ public func FfiConverterCallbackInterfaceAppleContentMetadataProvider_lift(_ handle: UInt64) throws -> AppleContentMetadataProvider {
3093
+ return try FfiConverterCallbackInterfaceAppleContentMetadataProvider.lift(handle)
3094
+ }
3095
+
3096
+ #if swift(>=5.8)
3097
+ @_documentation(visibility: private)
3098
+ #endif
3099
+ public func FfiConverterCallbackInterfaceAppleContentMetadataProvider_lower(_ v: AppleContentMetadataProvider) -> UInt64 {
3100
+ return FfiConverterCallbackInterfaceAppleContentMetadataProvider.lower(v)
3101
+ }
3102
+
3103
+
3104
+
3105
+
3106
+ public protocol AppleSessionPreSendHook: AnyObject, Sendable {
3107
+
3108
+ func willSend(serviceName: String, params: [String: String]) -> [String: String]
3109
+
3110
+ }
3111
+
3112
+
3113
+ // Put the implementation in a struct so we don't pollute the top-level namespace
3114
+ fileprivate struct UniffiCallbackInterfaceAppleSessionPreSendHook {
3115
+
3116
+ // Create the VTable using a series of closures.
3117
+ // Swift automatically converts these into C callback functions.
3118
+ //
3119
+ // Store the vtable directly.
3120
+ static let vtable: UniffiVTableCallbackInterfaceAppleSessionPreSendHook = UniffiVTableCallbackInterfaceAppleSessionPreSendHook(
3121
+ uniffiFree: { (uniffiHandle: UInt64) -> () in
3122
+ do {
3123
+ try FfiConverterCallbackInterfaceAppleSessionPreSendHook.handleMap.remove(handle: uniffiHandle)
3124
+ } catch {
3125
+ print("Uniffi callback interface AppleSessionPreSendHook: handle missing in uniffiFree")
3126
+ }
3127
+ },
3128
+ uniffiClone: { (uniffiHandle: UInt64) -> UInt64 in
3129
+ do {
3130
+ return try FfiConverterCallbackInterfaceAppleSessionPreSendHook.handleMap.clone(handle: uniffiHandle)
3131
+ } catch {
3132
+ fatalError("Uniffi callback interface AppleSessionPreSendHook: handle missing in uniffiClone")
3133
+ }
3134
+ },
3135
+ willSend: { (
3136
+ uniffiHandle: UInt64,
3137
+ serviceName: RustBuffer,
3138
+ params: RustBuffer,
3139
+ uniffiOutReturn: UnsafeMutablePointer<RustBuffer>,
3140
+ uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
3141
+ ) in
3142
+ let makeCall = {
3143
+ () throws -> [String: String] in
3144
+ guard let uniffiObj = try? FfiConverterCallbackInterfaceAppleSessionPreSendHook.handleMap.get(handle: uniffiHandle) else {
3145
+ throw UniffiInternalError.unexpectedStaleHandle
3146
+ }
3147
+ return uniffiObj.willSend(
3148
+ serviceName: try FfiConverterString.lift(serviceName),
3149
+ params: try FfiConverterDictionaryStringString.lift(params)
3150
+ )
3151
+ }
3152
+
3153
+
3154
+ let writeReturn = { uniffiOutReturn.pointee = FfiConverterDictionaryStringString.lower($0) }
3155
+ uniffiTraitInterfaceCall(
3156
+ callStatus: uniffiCallStatus,
3157
+ makeCall: makeCall,
3158
+ writeReturn: writeReturn
3159
+ )
3160
+ }
3161
+ )
3162
+
3163
+ // Rust stores this pointer for future callback invocations, so it must live
3164
+ // for the process lifetime (not just for the init function call).
3165
+ static let vtablePtr: UnsafePointer<UniffiVTableCallbackInterfaceAppleSessionPreSendHook> = {
3166
+ let ptr = UnsafeMutablePointer<UniffiVTableCallbackInterfaceAppleSessionPreSendHook>.allocate(capacity: 1)
3167
+ ptr.initialize(to: vtable)
3168
+ return UnsafePointer(ptr)
3169
+ }()
3170
+ }
3171
+
3172
+ private func uniffiCallbackInitAppleSessionPreSendHook() {
3173
+ uniffi_forge_kernel_uniffi_fn_init_callback_vtable_applesessionpresendhook(UniffiCallbackInterfaceAppleSessionPreSendHook.vtablePtr)
3174
+ }
3175
+
3176
+ // FfiConverter protocol for callback interfaces
3177
+ #if swift(>=5.8)
3178
+ @_documentation(visibility: private)
3179
+ #endif
3180
+ fileprivate struct FfiConverterCallbackInterfaceAppleSessionPreSendHook {
3181
+ fileprivate static let handleMap = UniffiHandleMap<AppleSessionPreSendHook>()
3182
+ }
3183
+
3184
+ #if swift(>=5.8)
3185
+ @_documentation(visibility: private)
3186
+ #endif
3187
+ extension FfiConverterCallbackInterfaceAppleSessionPreSendHook : FfiConverter {
3188
+ typealias SwiftType = AppleSessionPreSendHook
3189
+ typealias FfiType = UInt64
3190
+
3191
+ #if swift(>=5.8)
3192
+ @_documentation(visibility: private)
3193
+ #endif
3194
+ public static func lift(_ handle: UInt64) throws -> SwiftType {
3195
+ try handleMap.get(handle: handle)
3196
+ }
3197
+
3198
+ #if swift(>=5.8)
3199
+ @_documentation(visibility: private)
3200
+ #endif
3201
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
3202
+ let handle: UInt64 = try readInt(&buf)
3203
+ return try lift(handle)
3204
+ }
3205
+
3206
+ #if swift(>=5.8)
3207
+ @_documentation(visibility: private)
3208
+ #endif
3209
+ public static func lower(_ v: SwiftType) -> UInt64 {
3210
+ return handleMap.insert(obj: v)
3211
+ }
3212
+
3213
+ #if swift(>=5.8)
3214
+ @_documentation(visibility: private)
3215
+ #endif
3216
+ public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
3217
+ writeInt(&buf, lower(v))
3218
+ }
3219
+ }
3220
+
3221
+
3222
+ #if swift(>=5.8)
3223
+ @_documentation(visibility: private)
3224
+ #endif
3225
+ public func FfiConverterCallbackInterfaceAppleSessionPreSendHook_lift(_ handle: UInt64) throws -> AppleSessionPreSendHook {
3226
+ return try FfiConverterCallbackInterfaceAppleSessionPreSendHook.lift(handle)
3227
+ }
3228
+
3229
+ #if swift(>=5.8)
3230
+ @_documentation(visibility: private)
3231
+ #endif
3232
+ public func FfiConverterCallbackInterfaceAppleSessionPreSendHook_lower(_ v: AppleSessionPreSendHook) -> UInt64 {
3233
+ return FfiConverterCallbackInterfaceAppleSessionPreSendHook.lower(v)
3234
+ }
3235
+
3236
+
3237
+
3238
+
3239
+ public protocol AppleVideoPreSendHook: AnyObject, Sendable {
3240
+
3241
+ func willSend(eventName: String, viewId: UInt64, serviceName: String, params: [String: String]) -> [String: String]
3242
+
3243
+ }
3244
+
3245
+
3246
+ // Put the implementation in a struct so we don't pollute the top-level namespace
3247
+ fileprivate struct UniffiCallbackInterfaceAppleVideoPreSendHook {
3248
+
3249
+ // Create the VTable using a series of closures.
3250
+ // Swift automatically converts these into C callback functions.
3251
+ //
3252
+ // Store the vtable directly.
3253
+ static let vtable: UniffiVTableCallbackInterfaceAppleVideoPreSendHook = UniffiVTableCallbackInterfaceAppleVideoPreSendHook(
3254
+ uniffiFree: { (uniffiHandle: UInt64) -> () in
3255
+ do {
3256
+ try FfiConverterCallbackInterfaceAppleVideoPreSendHook.handleMap.remove(handle: uniffiHandle)
3257
+ } catch {
3258
+ print("Uniffi callback interface AppleVideoPreSendHook: handle missing in uniffiFree")
3259
+ }
3260
+ },
3261
+ uniffiClone: { (uniffiHandle: UInt64) -> UInt64 in
3262
+ do {
3263
+ return try FfiConverterCallbackInterfaceAppleVideoPreSendHook.handleMap.clone(handle: uniffiHandle)
3264
+ } catch {
3265
+ fatalError("Uniffi callback interface AppleVideoPreSendHook: handle missing in uniffiClone")
3266
+ }
3267
+ },
3268
+ willSend: { (
3269
+ uniffiHandle: UInt64,
3270
+ eventName: RustBuffer,
3271
+ viewId: UInt64,
3272
+ serviceName: RustBuffer,
3273
+ params: RustBuffer,
3274
+ uniffiOutReturn: UnsafeMutablePointer<RustBuffer>,
3275
+ uniffiCallStatus: UnsafeMutablePointer<RustCallStatus>
3276
+ ) in
3277
+ let makeCall = {
3278
+ () throws -> [String: String] in
3279
+ guard let uniffiObj = try? FfiConverterCallbackInterfaceAppleVideoPreSendHook.handleMap.get(handle: uniffiHandle) else {
3280
+ throw UniffiInternalError.unexpectedStaleHandle
3281
+ }
3282
+ return uniffiObj.willSend(
3283
+ eventName: try FfiConverterString.lift(eventName),
3284
+ viewId: try FfiConverterUInt64.lift(viewId),
3285
+ serviceName: try FfiConverterString.lift(serviceName),
3286
+ params: try FfiConverterDictionaryStringString.lift(params)
3287
+ )
3288
+ }
3289
+
3290
+
3291
+ let writeReturn = { uniffiOutReturn.pointee = FfiConverterDictionaryStringString.lower($0) }
3292
+ uniffiTraitInterfaceCall(
3293
+ callStatus: uniffiCallStatus,
3294
+ makeCall: makeCall,
3295
+ writeReturn: writeReturn
3296
+ )
3297
+ }
3298
+ )
3299
+
3300
+ // Rust stores this pointer for future callback invocations, so it must live
3301
+ // for the process lifetime (not just for the init function call).
3302
+ static let vtablePtr: UnsafePointer<UniffiVTableCallbackInterfaceAppleVideoPreSendHook> = {
3303
+ let ptr = UnsafeMutablePointer<UniffiVTableCallbackInterfaceAppleVideoPreSendHook>.allocate(capacity: 1)
3304
+ ptr.initialize(to: vtable)
3305
+ return UnsafePointer(ptr)
3306
+ }()
3307
+ }
3308
+
3309
+ private func uniffiCallbackInitAppleVideoPreSendHook() {
3310
+ uniffi_forge_kernel_uniffi_fn_init_callback_vtable_applevideopresendhook(UniffiCallbackInterfaceAppleVideoPreSendHook.vtablePtr)
3311
+ }
3312
+
3313
+ // FfiConverter protocol for callback interfaces
3314
+ #if swift(>=5.8)
3315
+ @_documentation(visibility: private)
3316
+ #endif
3317
+ fileprivate struct FfiConverterCallbackInterfaceAppleVideoPreSendHook {
3318
+ fileprivate static let handleMap = UniffiHandleMap<AppleVideoPreSendHook>()
3319
+ }
3320
+
3321
+ #if swift(>=5.8)
3322
+ @_documentation(visibility: private)
3323
+ #endif
3324
+ extension FfiConverterCallbackInterfaceAppleVideoPreSendHook : FfiConverter {
3325
+ typealias SwiftType = AppleVideoPreSendHook
3326
+ typealias FfiType = UInt64
3327
+
3328
+ #if swift(>=5.8)
3329
+ @_documentation(visibility: private)
3330
+ #endif
3331
+ public static func lift(_ handle: UInt64) throws -> SwiftType {
3332
+ try handleMap.get(handle: handle)
3333
+ }
3334
+
3335
+ #if swift(>=5.8)
3336
+ @_documentation(visibility: private)
3337
+ #endif
3338
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
3339
+ let handle: UInt64 = try readInt(&buf)
3340
+ return try lift(handle)
3341
+ }
3342
+
3343
+ #if swift(>=5.8)
3344
+ @_documentation(visibility: private)
3345
+ #endif
3346
+ public static func lower(_ v: SwiftType) -> UInt64 {
3347
+ return handleMap.insert(obj: v)
3348
+ }
3349
+
3350
+ #if swift(>=5.8)
3351
+ @_documentation(visibility: private)
3352
+ #endif
3353
+ public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
3354
+ writeInt(&buf, lower(v))
3355
+ }
3356
+ }
3357
+
3358
+
3359
+ #if swift(>=5.8)
3360
+ @_documentation(visibility: private)
3361
+ #endif
3362
+ public func FfiConverterCallbackInterfaceAppleVideoPreSendHook_lift(_ handle: UInt64) throws -> AppleVideoPreSendHook {
3363
+ return try FfiConverterCallbackInterfaceAppleVideoPreSendHook.lift(handle)
3364
+ }
3365
+
3366
+ #if swift(>=5.8)
3367
+ @_documentation(visibility: private)
3368
+ #endif
3369
+ public func FfiConverterCallbackInterfaceAppleVideoPreSendHook_lower(_ v: AppleVideoPreSendHook) -> UInt64 {
3370
+ return FfiConverterCallbackInterfaceAppleVideoPreSendHook.lower(v)
3371
+ }
3372
+
3373
+ #if swift(>=5.8)
3374
+ @_documentation(visibility: private)
3375
+ #endif
3376
+ fileprivate struct FfiConverterOptionUInt32: FfiConverterRustBuffer {
3377
+ typealias SwiftType = UInt32?
3378
+
3379
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
3380
+ guard let value = value else {
3381
+ writeInt(&buf, Int8(0))
3382
+ return
3383
+ }
3384
+ writeInt(&buf, Int8(1))
3385
+ FfiConverterUInt32.write(value, into: &buf)
3386
+ }
3387
+
3388
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
3389
+ switch try readInt(&buf) as Int8 {
3390
+ case 0: return nil
3391
+ case 1: return try FfiConverterUInt32.read(from: &buf)
3392
+ default: throw UniffiInternalError.unexpectedOptionalTag
3393
+ }
3394
+ }
3395
+ }
3396
+
3397
+ #if swift(>=5.8)
3398
+ @_documentation(visibility: private)
3399
+ #endif
3400
+ fileprivate struct FfiConverterOptionUInt64: FfiConverterRustBuffer {
3401
+ typealias SwiftType = UInt64?
3402
+
3403
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
3404
+ guard let value = value else {
3405
+ writeInt(&buf, Int8(0))
3406
+ return
3407
+ }
3408
+ writeInt(&buf, Int8(1))
3409
+ FfiConverterUInt64.write(value, into: &buf)
3410
+ }
3411
+
3412
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
3413
+ switch try readInt(&buf) as Int8 {
3414
+ case 0: return nil
3415
+ case 1: return try FfiConverterUInt64.read(from: &buf)
3416
+ default: throw UniffiInternalError.unexpectedOptionalTag
3417
+ }
3418
+ }
3419
+ }
3420
+
3421
+ #if swift(>=5.8)
3422
+ @_documentation(visibility: private)
3423
+ #endif
3424
+ fileprivate struct FfiConverterOptionInt64: FfiConverterRustBuffer {
3425
+ typealias SwiftType = Int64?
3426
+
3427
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
3428
+ guard let value = value else {
3429
+ writeInt(&buf, Int8(0))
3430
+ return
3431
+ }
3432
+ writeInt(&buf, Int8(1))
3433
+ FfiConverterInt64.write(value, into: &buf)
3434
+ }
3435
+
3436
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
3437
+ switch try readInt(&buf) as Int8 {
3438
+ case 0: return nil
3439
+ case 1: return try FfiConverterInt64.read(from: &buf)
3440
+ default: throw UniffiInternalError.unexpectedOptionalTag
3441
+ }
3442
+ }
3443
+ }
3444
+
3445
+ #if swift(>=5.8)
3446
+ @_documentation(visibility: private)
3447
+ #endif
3448
+ fileprivate struct FfiConverterOptionDouble: FfiConverterRustBuffer {
3449
+ typealias SwiftType = Double?
3450
+
3451
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
3452
+ guard let value = value else {
3453
+ writeInt(&buf, Int8(0))
3454
+ return
3455
+ }
3456
+ writeInt(&buf, Int8(1))
3457
+ FfiConverterDouble.write(value, into: &buf)
3458
+ }
3459
+
3460
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
3461
+ switch try readInt(&buf) as Int8 {
3462
+ case 0: return nil
3463
+ case 1: return try FfiConverterDouble.read(from: &buf)
3464
+ default: throw UniffiInternalError.unexpectedOptionalTag
3465
+ }
3466
+ }
3467
+ }
3468
+
3469
+ #if swift(>=5.8)
3470
+ @_documentation(visibility: private)
3471
+ #endif
3472
+ fileprivate struct FfiConverterOptionBool: FfiConverterRustBuffer {
3473
+ typealias SwiftType = Bool?
3474
+
3475
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
3476
+ guard let value = value else {
3477
+ writeInt(&buf, Int8(0))
3478
+ return
3479
+ }
3480
+ writeInt(&buf, Int8(1))
3481
+ FfiConverterBool.write(value, into: &buf)
3482
+ }
3483
+
3484
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
3485
+ switch try readInt(&buf) as Int8 {
3486
+ case 0: return nil
3487
+ case 1: return try FfiConverterBool.read(from: &buf)
3488
+ default: throw UniffiInternalError.unexpectedOptionalTag
3489
+ }
3490
+ }
3491
+ }
3492
+
3493
+ #if swift(>=5.8)
3494
+ @_documentation(visibility: private)
3495
+ #endif
3496
+ fileprivate struct FfiConverterOptionString: FfiConverterRustBuffer {
3497
+ typealias SwiftType = String?
3498
+
3499
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
3500
+ guard let value = value else {
3501
+ writeInt(&buf, Int8(0))
3502
+ return
3503
+ }
3504
+ writeInt(&buf, Int8(1))
3505
+ FfiConverterString.write(value, into: &buf)
3506
+ }
3507
+
3508
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
3509
+ switch try readInt(&buf) as Int8 {
3510
+ case 0: return nil
3511
+ case 1: return try FfiConverterString.read(from: &buf)
3512
+ default: throw UniffiInternalError.unexpectedOptionalTag
3513
+ }
3514
+ }
3515
+ }
3516
+
3517
+ #if swift(>=5.8)
3518
+ @_documentation(visibility: private)
3519
+ #endif
3520
+ fileprivate struct FfiConverterOptionTypeAppleAdViewabilitySample: FfiConverterRustBuffer {
3521
+ typealias SwiftType = AppleAdViewabilitySample?
3522
+
3523
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
3524
+ guard let value = value else {
3525
+ writeInt(&buf, Int8(0))
3526
+ return
3527
+ }
3528
+ writeInt(&buf, Int8(1))
3529
+ FfiConverterTypeAppleAdViewabilitySample.write(value, into: &buf)
3530
+ }
3531
+
3532
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
3533
+ switch try readInt(&buf) as Int8 {
3534
+ case 0: return nil
3535
+ case 1: return try FfiConverterTypeAppleAdViewabilitySample.read(from: &buf)
3536
+ default: throw UniffiInternalError.unexpectedOptionalTag
3537
+ }
3538
+ }
3539
+ }
3540
+
3541
+ #if swift(>=5.8)
3542
+ @_documentation(visibility: private)
3543
+ #endif
3544
+ fileprivate struct FfiConverterOptionTypeAppleCapturePlan: FfiConverterRustBuffer {
3545
+ typealias SwiftType = AppleCapturePlan?
3546
+
3547
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
3548
+ guard let value = value else {
3549
+ writeInt(&buf, Int8(0))
3550
+ return
3551
+ }
3552
+ writeInt(&buf, Int8(1))
3553
+ FfiConverterTypeAppleCapturePlan.write(value, into: &buf)
3554
+ }
3555
+
3556
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
3557
+ switch try readInt(&buf) as Int8 {
3558
+ case 0: return nil
3559
+ case 1: return try FfiConverterTypeAppleCapturePlan.read(from: &buf)
3560
+ default: throw UniffiInternalError.unexpectedOptionalTag
3561
+ }
3562
+ }
3563
+ }
3564
+
3565
+ #if swift(>=5.8)
3566
+ @_documentation(visibility: private)
3567
+ #endif
3568
+ fileprivate struct FfiConverterOptionTypeAppleMetadataSnapshot: FfiConverterRustBuffer {
3569
+ typealias SwiftType = AppleMetadataSnapshot?
3570
+
3571
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
3572
+ guard let value = value else {
3573
+ writeInt(&buf, Int8(0))
3574
+ return
3575
+ }
3576
+ writeInt(&buf, Int8(1))
3577
+ FfiConverterTypeAppleMetadataSnapshot.write(value, into: &buf)
3578
+ }
3579
+
3580
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
3581
+ switch try readInt(&buf) as Int8 {
3582
+ case 0: return nil
3583
+ case 1: return try FfiConverterTypeAppleMetadataSnapshot.read(from: &buf)
3584
+ default: throw UniffiInternalError.unexpectedOptionalTag
3585
+ }
3586
+ }
3587
+ }
3588
+
3589
+ #if swift(>=5.8)
3590
+ @_documentation(visibility: private)
3591
+ #endif
3592
+ fileprivate struct FfiConverterOptionTypeAppleQosSnapshot: FfiConverterRustBuffer {
3593
+ typealias SwiftType = AppleQosSnapshot?
3594
+
3595
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
3596
+ guard let value = value else {
3597
+ writeInt(&buf, Int8(0))
3598
+ return
3599
+ }
3600
+ writeInt(&buf, Int8(1))
3601
+ FfiConverterTypeAppleQosSnapshot.write(value, into: &buf)
3602
+ }
3603
+
3604
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
3605
+ switch try readInt(&buf) as Int8 {
3606
+ case 0: return nil
3607
+ case 1: return try FfiConverterTypeAppleQosSnapshot.read(from: &buf)
3608
+ default: throw UniffiInternalError.unexpectedOptionalTag
3609
+ }
3610
+ }
3611
+ }
3612
+
3613
+ #if swift(>=5.8)
3614
+ @_documentation(visibility: private)
3615
+ #endif
3616
+ fileprivate struct FfiConverterOptionTypeAppleRenderedLog: FfiConverterRustBuffer {
3617
+ typealias SwiftType = AppleRenderedLog?
3618
+
3619
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
3620
+ guard let value = value else {
3621
+ writeInt(&buf, Int8(0))
3622
+ return
3623
+ }
3624
+ writeInt(&buf, Int8(1))
3625
+ FfiConverterTypeAppleRenderedLog.write(value, into: &buf)
3626
+ }
3627
+
3628
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
3629
+ switch try readInt(&buf) as Int8 {
3630
+ case 0: return nil
3631
+ case 1: return try FfiConverterTypeAppleRenderedLog.read(from: &buf)
3632
+ default: throw UniffiInternalError.unexpectedOptionalTag
3633
+ }
3634
+ }
3635
+ }
3636
+
3637
+ #if swift(>=5.8)
3638
+ @_documentation(visibility: private)
3639
+ #endif
3640
+ fileprivate struct FfiConverterOptionTypeAppleAdPosition: FfiConverterRustBuffer {
3641
+ typealias SwiftType = AppleAdPosition?
3642
+
3643
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
3644
+ guard let value = value else {
3645
+ writeInt(&buf, Int8(0))
3646
+ return
3647
+ }
3648
+ writeInt(&buf, Int8(1))
3649
+ FfiConverterTypeAppleAdPosition.write(value, into: &buf)
3650
+ }
3651
+
3652
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
3653
+ switch try readInt(&buf) as Int8 {
3654
+ case 0: return nil
3655
+ case 1: return try FfiConverterTypeAppleAdPosition.read(from: &buf)
3656
+ default: throw UniffiInternalError.unexpectedOptionalTag
3657
+ }
3658
+ }
3659
+ }
3660
+
3661
+ #if swift(>=5.8)
3662
+ @_documentation(visibility: private)
3663
+ #endif
3664
+ fileprivate struct FfiConverterOptionDictionaryStringDouble: FfiConverterRustBuffer {
3665
+ typealias SwiftType = [String: Double]?
3666
+
3667
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
3668
+ guard let value = value else {
3669
+ writeInt(&buf, Int8(0))
3670
+ return
3671
+ }
3672
+ writeInt(&buf, Int8(1))
3673
+ FfiConverterDictionaryStringDouble.write(value, into: &buf)
3674
+ }
3675
+
3676
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
3677
+ switch try readInt(&buf) as Int8 {
3678
+ case 0: return nil
3679
+ case 1: return try FfiConverterDictionaryStringDouble.read(from: &buf)
3680
+ default: throw UniffiInternalError.unexpectedOptionalTag
3681
+ }
3682
+ }
3683
+ }
3684
+
3685
+ #if swift(>=5.8)
3686
+ @_documentation(visibility: private)
3687
+ #endif
3688
+ fileprivate struct FfiConverterOptionDictionaryStringString: FfiConverterRustBuffer {
3689
+ typealias SwiftType = [String: String]?
3690
+
3691
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
3692
+ guard let value = value else {
3693
+ writeInt(&buf, Int8(0))
3694
+ return
3695
+ }
3696
+ writeInt(&buf, Int8(1))
3697
+ FfiConverterDictionaryStringString.write(value, into: &buf)
3698
+ }
3699
+
3700
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
3701
+ switch try readInt(&buf) as Int8 {
3702
+ case 0: return nil
3703
+ case 1: return try FfiConverterDictionaryStringString.read(from: &buf)
3704
+ default: throw UniffiInternalError.unexpectedOptionalTag
3705
+ }
3706
+ }
3707
+ }
3708
+
3709
+ #if swift(>=5.8)
3710
+ @_documentation(visibility: private)
3711
+ #endif
3712
+ fileprivate struct FfiConverterSequenceString: FfiConverterRustBuffer {
3713
+ typealias SwiftType = [String]
3714
+
3715
+ public static func write(_ value: [String], into buf: inout [UInt8]) {
3716
+ let len = Int32(value.count)
3717
+ writeInt(&buf, len)
3718
+ for item in value {
3719
+ FfiConverterString.write(item, into: &buf)
3720
+ }
3721
+ }
3722
+
3723
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [String] {
3724
+ let len: Int32 = try readInt(&buf)
3725
+ var seq = [String]()
3726
+ seq.reserveCapacity(Int(len))
3727
+ for _ in 0 ..< len {
3728
+ seq.append(try FfiConverterString.read(from: &buf))
3729
+ }
3730
+ return seq
3731
+ }
3732
+ }
3733
+
3734
+ #if swift(>=5.8)
3735
+ @_documentation(visibility: private)
3736
+ #endif
3737
+ fileprivate struct FfiConverterSequenceTypeAppleRuntimeEventSnapshot: FfiConverterRustBuffer {
3738
+ typealias SwiftType = [AppleRuntimeEventSnapshot]
3739
+
3740
+ public static func write(_ value: [AppleRuntimeEventSnapshot], into buf: inout [UInt8]) {
3741
+ let len = Int32(value.count)
3742
+ writeInt(&buf, len)
3743
+ for item in value {
3744
+ FfiConverterTypeAppleRuntimeEventSnapshot.write(item, into: &buf)
3745
+ }
3746
+ }
3747
+
3748
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [AppleRuntimeEventSnapshot] {
3749
+ let len: Int32 = try readInt(&buf)
3750
+ var seq = [AppleRuntimeEventSnapshot]()
3751
+ seq.reserveCapacity(Int(len))
3752
+ for _ in 0 ..< len {
3753
+ seq.append(try FfiConverterTypeAppleRuntimeEventSnapshot.read(from: &buf))
3754
+ }
3755
+ return seq
3756
+ }
3757
+ }
3758
+
3759
+ #if swift(>=5.8)
3760
+ @_documentation(visibility: private)
3761
+ #endif
3762
+ fileprivate struct FfiConverterDictionaryStringDouble: FfiConverterRustBuffer {
3763
+ public static func write(_ value: [String: Double], into buf: inout [UInt8]) {
3764
+ let len = Int32(value.count)
3765
+ writeInt(&buf, len)
3766
+ for (key, value) in value {
3767
+ FfiConverterString.write(key, into: &buf)
3768
+ FfiConverterDouble.write(value, into: &buf)
3769
+ }
3770
+ }
3771
+
3772
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [String: Double] {
3773
+ let len: Int32 = try readInt(&buf)
3774
+ var dict = [String: Double]()
3775
+ dict.reserveCapacity(Int(len))
3776
+ for _ in 0..<len {
3777
+ let key = try FfiConverterString.read(from: &buf)
3778
+ let value = try FfiConverterDouble.read(from: &buf)
3779
+ dict[key] = value
3780
+ }
3781
+ return dict
3782
+ }
3783
+ }
3784
+
3785
+ #if swift(>=5.8)
3786
+ @_documentation(visibility: private)
3787
+ #endif
3788
+ fileprivate struct FfiConverterDictionaryStringString: FfiConverterRustBuffer {
3789
+ public static func write(_ value: [String: String], into buf: inout [UInt8]) {
3790
+ let len = Int32(value.count)
3791
+ writeInt(&buf, len)
3792
+ for (key, value) in value {
3793
+ FfiConverterString.write(key, into: &buf)
3794
+ FfiConverterString.write(value, into: &buf)
3795
+ }
3796
+ }
3797
+
3798
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [String: String] {
3799
+ let len: Int32 = try readInt(&buf)
3800
+ var dict = [String: String]()
3801
+ dict.reserveCapacity(Int(len))
3802
+ for _ in 0..<len {
3803
+ let key = try FfiConverterString.read(from: &buf)
3804
+ let value = try FfiConverterString.read(from: &buf)
3805
+ dict[key] = value
3806
+ }
3807
+ return dict
3808
+ }
3809
+ }
3810
+ public func forgePluginVersion() -> String {
3811
+ return try! FfiConverterString.lift(try! rustCall() {
3812
+ uniffi_forge_kernel_uniffi_fn_func_forge_plugin_version($0
3813
+ )
3814
+ })
3815
+ }
3816
+
3817
+ private enum InitializationResult {
3818
+ case ok
3819
+ case contractVersionMismatch
3820
+ case apiChecksumMismatch
3821
+ }
3822
+ // Use a global variable to perform the versioning checks. Swift ensures that
3823
+ // the code inside is only computed once.
3824
+ private let initializationResult: InitializationResult = {
3825
+ // Get the bindings contract version from our ComponentInterface
3826
+ let bindings_contract_version = 30
3827
+ // Get the scaffolding contract version by calling the into the dylib
3828
+ let scaffolding_contract_version = ffi_forge_kernel_uniffi_uniffi_contract_version()
3829
+ if bindings_contract_version != scaffolding_contract_version {
3830
+ return InitializationResult.contractVersionMismatch
3831
+ }
3832
+ if (uniffi_forge_kernel_uniffi_checksum_func_forge_plugin_version() != 6358) {
3833
+ return InitializationResult.apiChecksumMismatch
3834
+ }
3835
+ if (uniffi_forge_kernel_uniffi_checksum_method_forgeruntimebridge_capture_plan() != 22959) {
3836
+ return InitializationResult.apiChecksumMismatch
3837
+ }
3838
+ if (uniffi_forge_kernel_uniffi_checksum_method_forgeruntimebridge_clear_capture_plan_listener() != 42899) {
3839
+ return InitializationResult.apiChecksumMismatch
3840
+ }
3841
+ if (uniffi_forge_kernel_uniffi_checksum_method_forgeruntimebridge_clear_content_metadata_provider() != 29053) {
3842
+ return InitializationResult.apiChecksumMismatch
3843
+ }
3844
+ if (uniffi_forge_kernel_uniffi_checksum_method_forgeruntimebridge_clear_session_pre_send_hook() != 25451) {
3845
+ return InitializationResult.apiChecksumMismatch
3846
+ }
3847
+ if (uniffi_forge_kernel_uniffi_checksum_method_forgeruntimebridge_clear_video_pre_send_hook() != 37815) {
3848
+ return InitializationResult.apiChecksumMismatch
3849
+ }
3850
+ if (uniffi_forge_kernel_uniffi_checksum_method_forgeruntimebridge_create_video_view() != 19294) {
3851
+ return InitializationResult.apiChecksumMismatch
3852
+ }
3853
+ if (uniffi_forge_kernel_uniffi_checksum_method_forgeruntimebridge_destroy() != 1814) {
3854
+ return InitializationResult.apiChecksumMismatch
3855
+ }
3856
+ if (uniffi_forge_kernel_uniffi_checksum_method_forgeruntimebridge_record_ad_event() != 33930) {
3857
+ return InitializationResult.apiChecksumMismatch
3858
+ }
3859
+ if (uniffi_forge_kernel_uniffi_checksum_method_forgeruntimebridge_record_application_foreground() != 33514) {
3860
+ return InitializationResult.apiChecksumMismatch
3861
+ }
3862
+ if (uniffi_forge_kernel_uniffi_checksum_method_forgeruntimebridge_record_identity_event() != 47443) {
3863
+ return InitializationResult.apiChecksumMismatch
3864
+ }
3865
+ if (uniffi_forge_kernel_uniffi_checksum_method_forgeruntimebridge_record_network_event() != 5299) {
3866
+ return InitializationResult.apiChecksumMismatch
3867
+ }
3868
+ if (uniffi_forge_kernel_uniffi_checksum_method_forgeruntimebridge_record_player_event() != 11866) {
3869
+ return InitializationResult.apiChecksumMismatch
3870
+ }
3871
+ if (uniffi_forge_kernel_uniffi_checksum_method_forgeruntimebridge_record_session_event() != 32672) {
3872
+ return InitializationResult.apiChecksumMismatch
3873
+ }
3874
+ if (uniffi_forge_kernel_uniffi_checksum_method_forgeruntimebridge_set_capture_plan_listener() != 52103) {
3875
+ return InitializationResult.apiChecksumMismatch
3876
+ }
3877
+ if (uniffi_forge_kernel_uniffi_checksum_method_forgeruntimebridge_set_content_metadata_provider() != 18303) {
3878
+ return InitializationResult.apiChecksumMismatch
3879
+ }
3880
+ if (uniffi_forge_kernel_uniffi_checksum_method_forgeruntimebridge_set_log_level() != 1993) {
3881
+ return InitializationResult.apiChecksumMismatch
3882
+ }
3883
+ if (uniffi_forge_kernel_uniffi_checksum_method_forgeruntimebridge_set_session_pre_send_hook() != 21614) {
3884
+ return InitializationResult.apiChecksumMismatch
3885
+ }
3886
+ if (uniffi_forge_kernel_uniffi_checksum_method_forgeruntimebridge_set_video_pre_send_hook() != 61030) {
3887
+ return InitializationResult.apiChecksumMismatch
3888
+ }
3889
+ if (uniffi_forge_kernel_uniffi_checksum_method_forgeruntimebridge_snapshot_events() != 6144) {
3890
+ return InitializationResult.apiChecksumMismatch
3891
+ }
3892
+ if (uniffi_forge_kernel_uniffi_checksum_method_forgeruntimebridge_start() != 56553) {
3893
+ return InitializationResult.apiChecksumMismatch
3894
+ }
3895
+ if (uniffi_forge_kernel_uniffi_checksum_constructor_forgeruntimebridge_new() != 24278) {
3896
+ return InitializationResult.apiChecksumMismatch
3897
+ }
3898
+ if (uniffi_forge_kernel_uniffi_checksum_method_applecaptureplanlistener_on_plan() != 46911) {
3899
+ return InitializationResult.apiChecksumMismatch
3900
+ }
3901
+ if (uniffi_forge_kernel_uniffi_checksum_method_applecontentmetadataprovider_metadata_snapshot() != 21583) {
3902
+ return InitializationResult.apiChecksumMismatch
3903
+ }
3904
+ if (uniffi_forge_kernel_uniffi_checksum_method_applesessionpresendhook_will_send() != 48599) {
3905
+ return InitializationResult.apiChecksumMismatch
3906
+ }
3907
+ if (uniffi_forge_kernel_uniffi_checksum_method_applevideopresendhook_will_send() != 35608) {
3908
+ return InitializationResult.apiChecksumMismatch
3909
+ }
3910
+
3911
+ uniffiCallbackInitAppleCapturePlanListener()
3912
+ uniffiCallbackInitAppleContentMetadataProvider()
3913
+ uniffiCallbackInitAppleSessionPreSendHook()
3914
+ uniffiCallbackInitAppleVideoPreSendHook()
3915
+ return InitializationResult.ok
3916
+ }()
3917
+
3918
+ // Make the ensure init function public so that other modules which have external type references to
3919
+ // our types can call it.
3920
+ public func uniffiEnsureForgeKernelUniffiInitialized() {
3921
+ switch initializationResult {
3922
+ case .ok:
3923
+ break
3924
+ case .contractVersionMismatch:
3925
+ fatalError("UniFFI contract version mismatch: try cleaning and rebuilding your project")
3926
+ case .apiChecksumMismatch:
3927
+ fatalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
3928
+ }
3929
+ }
3930
+
3931
+ // swiftlint:enable all