// This file was autogenerated by some hot garbage in the `uniffi` crate. // Trust me, you don't want to mess with it! // swiftlint:disable all import Foundation // Depending on the consumer's build setup, the low-level FFI code // might be in a separate module, or it might be compiled inline into // this module. This is a bit of light hackery to work with both. #if canImport(gotcha_coreFFI) import gotcha_coreFFI #endif fileprivate extension RustBuffer { // Allocate a new buffer, copying the contents of a `UInt8` array. init(bytes: [UInt8]) { let rbuf = bytes.withUnsafeBufferPointer { ptr in RustBuffer.from(ptr) } self.init(capacity: rbuf.capacity, len: rbuf.len, data: rbuf.data) } static func empty() -> RustBuffer { RustBuffer(capacity: 0, len:0, data: nil) } static func from(_ ptr: UnsafeBufferPointer) -> RustBuffer { try! rustCall { ffi_gotcha_core_rustbuffer_from_bytes(ForeignBytes(bufferPointer: ptr), $0) } } // Frees the buffer in place. // The buffer must not be used after this is called. func deallocate() { try! rustCall { ffi_gotcha_core_rustbuffer_free(self, $0) } } } fileprivate extension ForeignBytes { init(bufferPointer: UnsafeBufferPointer) { self.init(len: Int32(bufferPointer.count), data: bufferPointer.baseAddress) } init(rawBufferPointer: UnsafeRawBufferPointer) { self.init( len: Int32(rawBufferPointer.count), data: rawBufferPointer.baseAddress?.assumingMemoryBound(to: UInt8.self) ) } } // Converter for `&[u8]` / `[ByRef] bytes` arguments. // // Conforms to `FfiConverter` so the compiler enforces the full converter // method set. Only the scope-bound `lower(_:_body:)` overload is sound — // zero-copy byte buffers only flow foreign -> Rust, and only in argument // position. The four protocol-witness methods (`lift`, `lower`, `read`, // `write`) `fatalError` at runtime if anyone reaches them. // // The scope-bound `lower` takes a closure because the `ForeignBytes` // pointer is only guaranteed valid for the duration of // `Data.withUnsafeBytes`. Callers must run the full FFI call inside // the closure body. fileprivate enum FfiConverterByRefBytes: FfiConverter { typealias SwiftType = Data typealias FfiType = ForeignBytes static func lower(_ value: Data, _ body: (ForeignBytes) throws -> R) rethrows -> R { return try value.withUnsafeBytes { rawBuf in try body(ForeignBytes(rawBufferPointer: rawBuf)) } } static func lower(_ value: Data) -> ForeignBytes { fatalError("ByRef bytes cannot use the plain lower: returning ForeignBytes escapes the Data.withUnsafeBytes scope. Use the scope-bound lower(_:_body:) overload instead.") } static func lift(_ value: ForeignBytes) throws -> Data { fatalError("ByRef bytes cannot be lifted: zero-copy &[u8] only flows foreign->Rust") } static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Data { fatalError("ByRef bytes cannot be read from a buffer: zero-copy &[u8] is only supported in argument position, not nested in records/options/etc.") } static func write(_ value: Data, into buf: inout [UInt8]) { fatalError("ByRef bytes cannot be written to a buffer: zero-copy &[u8] is only supported in argument position, not nested in records/options/etc.") } } // For every type used in the interface, we provide helper methods for conveniently // lifting and lowering that type from C-compatible data, and for reading and writing // values of that type in a buffer. // Helper classes/extensions that don't change. // Someday, this will be in a library of its own. fileprivate extension Data { init(rustBuffer: RustBuffer) { self.init( bytesNoCopy: rustBuffer.data!, count: Int(rustBuffer.len), deallocator: .none ) } } // Define reader functionality. Normally this would be defined in a class or // struct, but we use standalone functions instead in order to make external // types work. // // With external types, one swift source file needs to be able to call the read // method on another source file's FfiConverter, but then what visibility // should Reader have? // - If Reader is fileprivate, then this means the read() must also // be fileprivate, which doesn't work with external types. // - If Reader is internal/public, we'll get compile errors since both source // files will try define the same type. // // Instead, the read() method and these helper functions input a tuple of data fileprivate func createReader(data: Data) -> (data: Data, offset: Data.Index) { (data: data, offset: 0) } // Reads an integer at the current offset, in big-endian order, and advances // the offset on success. Throws if reading the integer would move the // offset past the end of the buffer. fileprivate func readInt(_ reader: inout (data: Data, offset: Data.Index)) throws -> T { let range = reader.offset...size guard reader.data.count >= range.upperBound else { throw UniffiInternalError.bufferOverflow } if T.self == UInt8.self { let value = reader.data[reader.offset] reader.offset += 1 return value as! T } var value: T = 0 let _ = withUnsafeMutableBytes(of: &value, { reader.data.copyBytes(to: $0, from: range)}) reader.offset = range.upperBound return value.bigEndian } // Reads an arbitrary number of bytes, to be used to read // raw bytes, this is useful when lifting strings fileprivate func readBytes(_ reader: inout (data: Data, offset: Data.Index), count: Int) throws -> Array { let range = reader.offset..<(reader.offset+count) guard reader.data.count >= range.upperBound else { throw UniffiInternalError.bufferOverflow } var value = [UInt8](repeating: 0, count: count) value.withUnsafeMutableBufferPointer({ buffer in reader.data.copyBytes(to: buffer, from: range) }) reader.offset = range.upperBound return value } // Reads a float at the current offset. fileprivate func readFloat(_ reader: inout (data: Data, offset: Data.Index)) throws -> Float { return Float(bitPattern: try readInt(&reader)) } // Reads a float at the current offset. fileprivate func readDouble(_ reader: inout (data: Data, offset: Data.Index)) throws -> Double { return Double(bitPattern: try readInt(&reader)) } // Indicates if the offset has reached the end of the buffer. fileprivate func hasRemaining(_ reader: (data: Data, offset: Data.Index)) -> Bool { return reader.offset < reader.data.count } // Define writer functionality. Normally this would be defined in a class or // struct, but we use standalone functions instead in order to make external // types work. See the above discussion on Readers for details. fileprivate func createWriter() -> [UInt8] { return [] } fileprivate func writeBytes(_ writer: inout [UInt8], _ byteArr: S) where S: Sequence, S.Element == UInt8 { writer.append(contentsOf: byteArr) } // Writes an integer in big-endian order. // // Warning: make sure what you are trying to write // is in the correct type! fileprivate func writeInt(_ writer: inout [UInt8], _ value: T) { var value = value.bigEndian withUnsafeBytes(of: &value) { writer.append(contentsOf: $0) } } fileprivate func writeFloat(_ writer: inout [UInt8], _ value: Float) { writeInt(&writer, value.bitPattern) } fileprivate func writeDouble(_ writer: inout [UInt8], _ value: Double) { writeInt(&writer, value.bitPattern) } // Protocol for types that transfer other types across the FFI. This is // analogous to the Rust trait of the same name. fileprivate protocol FfiConverter { associatedtype FfiType associatedtype SwiftType static func lift(_ value: FfiType) throws -> SwiftType static func lower(_ value: SwiftType) -> FfiType static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType static func write(_ value: SwiftType, into buf: inout [UInt8]) } // Types conforming to `Primitive` pass themselves directly over the FFI. fileprivate protocol FfiConverterPrimitive: FfiConverter where FfiType == SwiftType { } extension FfiConverterPrimitive { #if swift(>=5.8) @_documentation(visibility: private) #endif public static func lift(_ value: FfiType) throws -> SwiftType { return value } #if swift(>=5.8) @_documentation(visibility: private) #endif public static func lower(_ value: SwiftType) -> FfiType { return value } } // Types conforming to `FfiConverterRustBuffer` lift and lower into a `RustBuffer`. // Used for complex types where it's hard to write a custom lift/lower. fileprivate protocol FfiConverterRustBuffer: FfiConverter where FfiType == RustBuffer {} extension FfiConverterRustBuffer { #if swift(>=5.8) @_documentation(visibility: private) #endif public static func lift(_ buf: RustBuffer) throws -> SwiftType { var reader = createReader(data: Data(rustBuffer: buf)) let value = try read(from: &reader) if hasRemaining(reader) { throw UniffiInternalError.incompleteData } buf.deallocate() return value } #if swift(>=5.8) @_documentation(visibility: private) #endif public static func lower(_ value: SwiftType) -> RustBuffer { var writer = createWriter() write(value, into: &writer) return RustBuffer(bytes: writer) } } // An error type for FFI errors. These errors occur at the UniFFI level, not // the library level. fileprivate enum UniffiInternalError: LocalizedError { case bufferOverflow case incompleteData case unexpectedOptionalTag case unexpectedEnumCase case unexpectedNullPointer case unexpectedRustCallStatusCode case unexpectedRustCallError case unexpectedStaleHandle case rustPanic(_ message: String) public var errorDescription: String? { switch self { case .bufferOverflow: return "Reading the requested value would read past the end of the buffer" case .incompleteData: return "The buffer still has data after lifting its containing value" case .unexpectedOptionalTag: return "Unexpected optional tag; should be 0 or 1" case .unexpectedEnumCase: return "Raw enum value doesn't match any cases" case .unexpectedNullPointer: return "Raw pointer value was null" case .unexpectedRustCallStatusCode: return "Unexpected RustCallStatus code" case .unexpectedRustCallError: return "CALL_ERROR but no errorClass specified" case .unexpectedStaleHandle: return "The object in the handle map has been dropped already" case let .rustPanic(message): return message } } } fileprivate extension NSLock { func withLock(f: () throws -> T) rethrows -> T { self.lock() defer { self.unlock() } return try f() } } fileprivate let CALL_SUCCESS: Int8 = 0 fileprivate let CALL_ERROR: Int8 = 1 fileprivate let CALL_UNEXPECTED_ERROR: Int8 = 2 fileprivate let CALL_CANCELLED: Int8 = 3 fileprivate extension RustCallStatus { init() { self.init( code: CALL_SUCCESS, errorBuf: RustBuffer.init( capacity: 0, len: 0, data: nil ) ) } } private func rustCall(_ callback: (UnsafeMutablePointer) -> T) throws -> T { let neverThrow: ((RustBuffer) throws -> Never)? = nil return try makeRustCall(callback, errorHandler: neverThrow) } private func rustCallWithError( _ errorHandler: @escaping (RustBuffer) throws -> E, _ callback: (UnsafeMutablePointer) -> T) throws -> T { try makeRustCall(callback, errorHandler: errorHandler) } private func makeRustCall( _ callback: (UnsafeMutablePointer) -> T, errorHandler: ((RustBuffer) throws -> E)? ) throws -> T { uniffiEnsureGotchaCoreInitialized() var callStatus = RustCallStatus.init() let returnedVal = callback(&callStatus) try uniffiCheckCallStatus(callStatus: callStatus, errorHandler: errorHandler) return returnedVal } private func uniffiCheckCallStatus( callStatus: RustCallStatus, errorHandler: ((RustBuffer) throws -> E)? ) throws { switch callStatus.code { case CALL_SUCCESS: return case CALL_ERROR: if let errorHandler = errorHandler { throw try errorHandler(callStatus.errorBuf) } else { callStatus.errorBuf.deallocate() throw UniffiInternalError.unexpectedRustCallError } case CALL_UNEXPECTED_ERROR: // When the rust code sees a panic, it tries to construct a RustBuffer // with the message. But if that code panics, then it just sends back // an empty buffer. if callStatus.errorBuf.len > 0 { throw UniffiInternalError.rustPanic(try FfiConverterString.lift(callStatus.errorBuf)) } else { callStatus.errorBuf.deallocate() throw UniffiInternalError.rustPanic("Rust panic") } case CALL_CANCELLED: fatalError("Cancellation not supported yet") default: throw UniffiInternalError.unexpectedRustCallStatusCode } } private func uniffiTraitInterfaceCall( callStatus: UnsafeMutablePointer, makeCall: () throws -> T, writeReturn: (T) -> () ) { do { try writeReturn(makeCall()) } catch let error { callStatus.pointee.code = CALL_UNEXPECTED_ERROR callStatus.pointee.errorBuf = FfiConverterString.lower(String(describing: error)) } } private func uniffiTraitInterfaceCallWithError( callStatus: UnsafeMutablePointer, makeCall: () throws -> T, writeReturn: (T) -> (), lowerError: (E) -> RustBuffer ) { do { try writeReturn(makeCall()) } catch let error as E { callStatus.pointee.code = CALL_ERROR callStatus.pointee.errorBuf = lowerError(error) } catch { callStatus.pointee.code = CALL_UNEXPECTED_ERROR callStatus.pointee.errorBuf = FfiConverterString.lower(String(describing: error)) } } // Initial value and increment amount for handles. // These ensure that SWIFT handles always have the lowest bit set fileprivate let UNIFFI_HANDLEMAP_INITIAL: UInt64 = 1 fileprivate let UNIFFI_HANDLEMAP_DELTA: UInt64 = 2 fileprivate final class UniffiHandleMap: @unchecked Sendable { // All mutation happens with this lock held, which is why we implement @unchecked Sendable. private let lock = NSLock() private var map: [UInt64: T] = [:] private var currentHandle: UInt64 = UNIFFI_HANDLEMAP_INITIAL func insert(obj: T) -> UInt64 { lock.withLock { return doInsert(obj) } } // Low-level insert function, this assumes `lock` is held. private func doInsert(_ obj: T) -> UInt64 { let handle = currentHandle currentHandle += UNIFFI_HANDLEMAP_DELTA map[handle] = obj return handle } func get(handle: UInt64) throws -> T { try lock.withLock { guard let obj = map[handle] else { throw UniffiInternalError.unexpectedStaleHandle } return obj } } func clone(handle: UInt64) throws -> UInt64 { try lock.withLock { guard let obj = map[handle] else { throw UniffiInternalError.unexpectedStaleHandle } return doInsert(obj) } } @discardableResult func remove(handle: UInt64) throws -> T { try lock.withLock { guard let obj = map.removeValue(forKey: handle) else { throw UniffiInternalError.unexpectedStaleHandle } return obj } } var count: Int { get { map.count } } } // Public interface members begin here. #if swift(>=5.8) @_documentation(visibility: private) #endif fileprivate struct FfiConverterUInt32: FfiConverterPrimitive { typealias FfiType = UInt32 typealias SwiftType = UInt32 public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UInt32 { return try lift(readInt(&buf)) } public static func write(_ value: SwiftType, into buf: inout [UInt8]) { writeInt(&buf, lower(value)) } } #if swift(>=5.8) @_documentation(visibility: private) #endif fileprivate struct FfiConverterInt64: FfiConverterPrimitive { typealias FfiType = Int64 typealias SwiftType = Int64 public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Int64 { return try lift(readInt(&buf)) } public static func write(_ value: Int64, into buf: inout [UInt8]) { writeInt(&buf, lower(value)) } } #if swift(>=5.8) @_documentation(visibility: private) #endif fileprivate struct FfiConverterBool : FfiConverter { typealias FfiType = Int8 typealias SwiftType = Bool public static func lift(_ value: Int8) throws -> Bool { return value != 0 } public static func lower(_ value: Bool) -> Int8 { return value ? 1 : 0 } public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Bool { return try lift(readInt(&buf)) } public static func write(_ value: Bool, into buf: inout [UInt8]) { writeInt(&buf, lower(value)) } } #if swift(>=5.8) @_documentation(visibility: private) #endif fileprivate struct FfiConverterString: FfiConverter { typealias SwiftType = String typealias FfiType = RustBuffer public static func lift(_ value: RustBuffer) throws -> String { defer { value.deallocate() } if value.data == nil { return String() } let bytes = UnsafeBufferPointer(start: value.data!, count: Int(value.len)) // Use Swift's native UTF-8 decoder; `String(bytes:encoding:.utf8)` goes // through Foundation's NSString and silently strips a leading U+FEFF BOM. // Invalid UTF-8 substitutes U+FFFD instead of trapping (unreachable // given Rust's `String` invariant). return String(decoding: bytes, as: UTF8.self) } public static func lower(_ value: String) -> RustBuffer { return value.utf8CString.withUnsafeBufferPointer { ptr in // The swift string gives us int8_t, we want uint8_t. ptr.withMemoryRebound(to: UInt8.self) { ptr in // The swift string gives us a trailing null byte, we don't want it. let buf = UnsafeBufferPointer(rebasing: ptr.prefix(upTo: ptr.count - 1)) return RustBuffer.from(buf) } } } public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> String { let len: Int32 = try readInt(&buf) // See `lift` above for why we avoid Foundation's NSString-backed decoder here. return String(decoding: try readBytes(&buf, count: Int(len)), as: UTF8.self) } public static func write(_ value: String, into buf: inout [UInt8]) { let len = Int32(value.utf8.count) writeInt(&buf, len) writeBytes(&buf, value.utf8) } } public protocol GotchaCoreProtocol: AnyObject, Sendable { func activeServerIndex() -> UInt32? func activeServerName() -> String? func addServer(name: String, url: String, token: String) async throws -> UInt32 func commitDiff(owner: String, repository: String, sha: String, path: String) async throws -> DiffPage func commitFiles(owner: String, repository: String, sha: String) async throws -> [FileRow] func commits(owner: String, repository: String, branch: String?) async throws -> CommitPage func home() async throws -> HomePage func issue(owner: String, repository: String, number: Int64) async throws -> IssuePage func issues(owner: String, repository: String) async throws -> [IssueRow] func milestone(owner: String, repository: String, id: Int64) async throws -> MilestonePage func milestones(owner: String, repository: String) async throws -> [MilestoneRow] func pull(owner: String, repository: String, number: Int64) async throws -> PullPage func pullDiff(owner: String, repository: String, number: Int64, path: String) async throws -> DiffPage func pulls() async throws -> [PullRow] func repositories() async throws -> [RepositoryRow] func selectServer(index: UInt32) throws func servers() -> [ServerRow] func setAppearance(index: UInt32) throws func setIssueStatus(status: String) throws func setPullStatus(status: String) throws func settings() -> Settings func startupError() -> String? func toggleFavorite(owner: String, repository: String) throws -> [RepositoryRow] } open class GotchaCore: GotchaCoreProtocol, @unchecked Sendable { fileprivate let handle: UInt64 /// Used to instantiate a [FFIObject] without an actual handle, for fakes in tests, mostly. #if swift(>=5.8) @_documentation(visibility: private) #endif public struct NoHandle { public init() {} } // TODO: We'd like this to be `private` but for Swifty reasons, // we can't implement `FfiConverter` without making this `required` and we can't // make it `required` without making it `public`. #if swift(>=5.8) @_documentation(visibility: private) #endif required public init(unsafeFromHandle handle: UInt64) { self.handle = handle } // This constructor can be used to instantiate a fake object. // - Parameter noHandle: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject]. // // - Warning: // 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. #if swift(>=5.8) @_documentation(visibility: private) #endif public init(noHandle: NoHandle) { self.handle = 0 } #if swift(>=5.8) @_documentation(visibility: private) #endif public func uniffiCloneHandle() -> UInt64 { return try! rustCall { uniffi_gotcha_core_fn_clone_gotchacore(self.handle, $0) } } public convenience init() { let handle = try! rustCall() { uniffiCallStatus in uniffi_gotcha_core_fn_constructor_gotchacore_new(uniffiCallStatus ) } self.init(unsafeFromHandle: handle) } deinit { if handle == 0 { // Mock objects have handle=0 don't try to free them return } try! rustCall { uniffi_gotcha_core_fn_free_gotchacore(handle, $0) } } open func activeServerIndex() -> UInt32? { return try! FfiConverterOptionUInt32.lift(try! rustCall() { uniffiCallStatus in uniffi_gotcha_core_fn_method_gotchacore_active_server_index( self.uniffiCloneHandle(),uniffiCallStatus ) }) } open func activeServerName() -> String? { return try! FfiConverterOptionString.lift(try! rustCall() { uniffiCallStatus in uniffi_gotcha_core_fn_method_gotchacore_active_server_name( self.uniffiCloneHandle(),uniffiCallStatus ) }) } open func addServer(name: String, url: String, token: String)async throws -> UInt32 { return try await uniffiRustCallAsync( rustFutureFunc: { uniffi_gotcha_core_fn_method_gotchacore_add_server( self.uniffiCloneHandle(),FfiConverterString.lower(name),FfiConverterString.lower(url),FfiConverterString.lower(token) ) }, pollFunc: ffi_gotcha_core_rust_future_poll_u32, completeFunc: ffi_gotcha_core_rust_future_complete_u32, freeFunc: ffi_gotcha_core_rust_future_free_u32, liftFunc: FfiConverterUInt32.lift, errorHandler: FfiConverterTypeGotchaError_lift ) } open func commitDiff(owner: String, repository: String, sha: String, path: String)async throws -> DiffPage { return try await uniffiRustCallAsync( rustFutureFunc: { uniffi_gotcha_core_fn_method_gotchacore_commit_diff( self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository),FfiConverterString.lower(sha),FfiConverterString.lower(path) ) }, pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer, completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer, freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer, liftFunc: FfiConverterTypeDiffPage_lift, errorHandler: FfiConverterTypeGotchaError_lift ) } open func commitFiles(owner: String, repository: String, sha: String)async throws -> [FileRow] { return try await uniffiRustCallAsync( rustFutureFunc: { uniffi_gotcha_core_fn_method_gotchacore_commit_files( self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository),FfiConverterString.lower(sha) ) }, pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer, completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer, freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer, liftFunc: FfiConverterSequenceTypeFileRow.lift, errorHandler: FfiConverterTypeGotchaError_lift ) } open func commits(owner: String, repository: String, branch: String?)async throws -> CommitPage { return try await uniffiRustCallAsync( rustFutureFunc: { uniffi_gotcha_core_fn_method_gotchacore_commits( self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository),FfiConverterOptionString.lower(branch) ) }, pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer, completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer, freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer, liftFunc: FfiConverterTypeCommitPage_lift, errorHandler: FfiConverterTypeGotchaError_lift ) } open func home()async throws -> HomePage { return try await uniffiRustCallAsync( rustFutureFunc: { uniffi_gotcha_core_fn_method_gotchacore_home( self.uniffiCloneHandle() ) }, pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer, completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer, freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer, liftFunc: FfiConverterTypeHomePage_lift, errorHandler: FfiConverterTypeGotchaError_lift ) } open func issue(owner: String, repository: String, number: Int64)async throws -> IssuePage { return try await uniffiRustCallAsync( rustFutureFunc: { uniffi_gotcha_core_fn_method_gotchacore_issue( self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository),FfiConverterInt64.lower(number) ) }, pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer, completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer, freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer, liftFunc: FfiConverterTypeIssuePage_lift, errorHandler: FfiConverterTypeGotchaError_lift ) } open func issues(owner: String, repository: String)async throws -> [IssueRow] { return try await uniffiRustCallAsync( rustFutureFunc: { uniffi_gotcha_core_fn_method_gotchacore_issues( self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository) ) }, pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer, completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer, freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer, liftFunc: FfiConverterSequenceTypeIssueRow.lift, errorHandler: FfiConverterTypeGotchaError_lift ) } open func milestone(owner: String, repository: String, id: Int64)async throws -> MilestonePage { return try await uniffiRustCallAsync( rustFutureFunc: { uniffi_gotcha_core_fn_method_gotchacore_milestone( self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository),FfiConverterInt64.lower(id) ) }, pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer, completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer, freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer, liftFunc: FfiConverterTypeMilestonePage_lift, errorHandler: FfiConverterTypeGotchaError_lift ) } open func milestones(owner: String, repository: String)async throws -> [MilestoneRow] { return try await uniffiRustCallAsync( rustFutureFunc: { uniffi_gotcha_core_fn_method_gotchacore_milestones( self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository) ) }, pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer, completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer, freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer, liftFunc: FfiConverterSequenceTypeMilestoneRow.lift, errorHandler: FfiConverterTypeGotchaError_lift ) } open func pull(owner: String, repository: String, number: Int64)async throws -> PullPage { return try await uniffiRustCallAsync( rustFutureFunc: { uniffi_gotcha_core_fn_method_gotchacore_pull( self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository),FfiConverterInt64.lower(number) ) }, pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer, completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer, freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer, liftFunc: FfiConverterTypePullPage_lift, errorHandler: FfiConverterTypeGotchaError_lift ) } open func pullDiff(owner: String, repository: String, number: Int64, path: String)async throws -> DiffPage { return try await uniffiRustCallAsync( rustFutureFunc: { uniffi_gotcha_core_fn_method_gotchacore_pull_diff( self.uniffiCloneHandle(),FfiConverterString.lower(owner),FfiConverterString.lower(repository),FfiConverterInt64.lower(number),FfiConverterString.lower(path) ) }, pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer, completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer, freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer, liftFunc: FfiConverterTypeDiffPage_lift, errorHandler: FfiConverterTypeGotchaError_lift ) } open func pulls()async throws -> [PullRow] { return try await uniffiRustCallAsync( rustFutureFunc: { uniffi_gotcha_core_fn_method_gotchacore_pulls( self.uniffiCloneHandle() ) }, pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer, completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer, freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer, liftFunc: FfiConverterSequenceTypePullRow.lift, errorHandler: FfiConverterTypeGotchaError_lift ) } open func repositories()async throws -> [RepositoryRow] { return try await uniffiRustCallAsync( rustFutureFunc: { uniffi_gotcha_core_fn_method_gotchacore_repositories( self.uniffiCloneHandle() ) }, pollFunc: ffi_gotcha_core_rust_future_poll_rust_buffer, completeFunc: ffi_gotcha_core_rust_future_complete_rust_buffer, freeFunc: ffi_gotcha_core_rust_future_free_rust_buffer, liftFunc: FfiConverterSequenceTypeRepositoryRow.lift, errorHandler: FfiConverterTypeGotchaError_lift ) } open func selectServer(index: UInt32)throws {try rustCallWithError(FfiConverterTypeGotchaError_lift) { uniffiCallStatus in uniffi_gotcha_core_fn_method_gotchacore_select_server( self.uniffiCloneHandle(), FfiConverterUInt32.lower(index),uniffiCallStatus ) } } open func servers() -> [ServerRow] { return try! FfiConverterSequenceTypeServerRow.lift(try! rustCall() { uniffiCallStatus in uniffi_gotcha_core_fn_method_gotchacore_servers( self.uniffiCloneHandle(),uniffiCallStatus ) }) } open func setAppearance(index: UInt32)throws {try rustCallWithError(FfiConverterTypeGotchaError_lift) { uniffiCallStatus in uniffi_gotcha_core_fn_method_gotchacore_set_appearance( self.uniffiCloneHandle(), FfiConverterUInt32.lower(index),uniffiCallStatus ) } } open func setIssueStatus(status: String)throws {try rustCallWithError(FfiConverterTypeGotchaError_lift) { uniffiCallStatus in uniffi_gotcha_core_fn_method_gotchacore_set_issue_status( self.uniffiCloneHandle(), FfiConverterString.lower(status),uniffiCallStatus ) } } open func setPullStatus(status: String)throws {try rustCallWithError(FfiConverterTypeGotchaError_lift) { uniffiCallStatus in uniffi_gotcha_core_fn_method_gotchacore_set_pull_status( self.uniffiCloneHandle(), FfiConverterString.lower(status),uniffiCallStatus ) } } open func settings() -> Settings { return try! FfiConverterTypeSettings_lift(try! rustCall() { uniffiCallStatus in uniffi_gotcha_core_fn_method_gotchacore_settings( self.uniffiCloneHandle(),uniffiCallStatus ) }) } open func startupError() -> String? { return try! FfiConverterOptionString.lift(try! rustCall() { uniffiCallStatus in uniffi_gotcha_core_fn_method_gotchacore_startup_error( self.uniffiCloneHandle(),uniffiCallStatus ) }) } open func toggleFavorite(owner: String, repository: String)throws -> [RepositoryRow] { return try FfiConverterSequenceTypeRepositoryRow.lift(try rustCallWithError(FfiConverterTypeGotchaError_lift) { uniffiCallStatus in uniffi_gotcha_core_fn_method_gotchacore_toggle_favorite( self.uniffiCloneHandle(), FfiConverterString.lower(owner), FfiConverterString.lower(repository),uniffiCallStatus ) }) } } #if swift(>=5.8) @_documentation(visibility: private) #endif public struct FfiConverterTypeGotchaCore: FfiConverter { typealias FfiType = UInt64 typealias SwiftType = GotchaCore public static func lift(_ handle: UInt64) throws -> GotchaCore { return GotchaCore(unsafeFromHandle: handle) } public static func lower(_ value: GotchaCore) -> UInt64 { return value.uniffiCloneHandle() } public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> GotchaCore { let handle: UInt64 = try readInt(&buf) return try lift(handle) } public static func write(_ value: GotchaCore, into buf: inout [UInt8]) { writeInt(&buf, lower(value)) } } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeGotchaCore_lift(_ handle: UInt64) throws -> GotchaCore { return try FfiConverterTypeGotchaCore.lift(handle) } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeGotchaCore_lower(_ value: GotchaCore) -> UInt64 { return FfiConverterTypeGotchaCore.lower(value) } public struct ActivityRow: Equatable, Hashable { public var icon: String public var title: String public var detail: String public var meta: String public var target: String public var owner: String public var repository: String public var number: Int64 public var sha: String // Default memberwise initializers are never public by default, so we // declare one manually. public init(icon: String, title: String, detail: String, meta: String, target: String, owner: String, repository: String, number: Int64, sha: String) { self.icon = icon self.title = title self.detail = detail self.meta = meta self.target = target self.owner = owner self.repository = repository self.number = number self.sha = sha } } #if compiler(>=6) extension ActivityRow: Sendable {} #endif #if swift(>=5.8) @_documentation(visibility: private) #endif public struct FfiConverterTypeActivityRow: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ActivityRow { return try ActivityRow( icon: FfiConverterString.read(from: &buf), title: FfiConverterString.read(from: &buf), detail: FfiConverterString.read(from: &buf), meta: FfiConverterString.read(from: &buf), target: FfiConverterString.read(from: &buf), owner: FfiConverterString.read(from: &buf), repository: FfiConverterString.read(from: &buf), number: FfiConverterInt64.read(from: &buf), sha: FfiConverterString.read(from: &buf) ) } public static func write(_ value: ActivityRow, into buf: inout [UInt8]) { FfiConverterString.write(value.icon, into: &buf) FfiConverterString.write(value.title, into: &buf) FfiConverterString.write(value.detail, into: &buf) FfiConverterString.write(value.meta, into: &buf) FfiConverterString.write(value.target, into: &buf) FfiConverterString.write(value.owner, into: &buf) FfiConverterString.write(value.repository, into: &buf) FfiConverterInt64.write(value.number, into: &buf) FfiConverterString.write(value.sha, into: &buf) } } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeActivityRow_lift(_ buf: RustBuffer) throws -> ActivityRow { return try FfiConverterTypeActivityRow.lift(buf) } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeActivityRow_lower(_ value: ActivityRow) -> RustBuffer { return FfiConverterTypeActivityRow.lower(value) } public struct CommentRow: Equatable, Hashable { public var author: String public var body: String public var meta: String // Default memberwise initializers are never public by default, so we // declare one manually. public init(author: String, body: String, meta: String) { self.author = author self.body = body self.meta = meta } } #if compiler(>=6) extension CommentRow: Sendable {} #endif #if swift(>=5.8) @_documentation(visibility: private) #endif public struct FfiConverterTypeCommentRow: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> CommentRow { return try CommentRow( author: FfiConverterString.read(from: &buf), body: FfiConverterString.read(from: &buf), meta: FfiConverterString.read(from: &buf) ) } public static func write(_ value: CommentRow, into buf: inout [UInt8]) { FfiConverterString.write(value.author, into: &buf) FfiConverterString.write(value.body, into: &buf) FfiConverterString.write(value.meta, into: &buf) } } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeCommentRow_lift(_ buf: RustBuffer) throws -> CommentRow { return try FfiConverterTypeCommentRow.lift(buf) } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeCommentRow_lower(_ value: CommentRow) -> RustBuffer { return FfiConverterTypeCommentRow.lower(value) } public struct CommitPage: Equatable, Hashable { public var branches: [String] public var commits: [CommitRow] public var laneCount: UInt32 // Default memberwise initializers are never public by default, so we // declare one manually. public init(branches: [String], commits: [CommitRow], laneCount: UInt32) { self.branches = branches self.commits = commits self.laneCount = laneCount } } #if compiler(>=6) extension CommitPage: Sendable {} #endif #if swift(>=5.8) @_documentation(visibility: private) #endif public struct FfiConverterTypeCommitPage: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> CommitPage { return try CommitPage( branches: FfiConverterSequenceString.read(from: &buf), commits: FfiConverterSequenceTypeCommitRow.read(from: &buf), laneCount: FfiConverterUInt32.read(from: &buf) ) } public static func write(_ value: CommitPage, into buf: inout [UInt8]) { FfiConverterSequenceString.write(value.branches, into: &buf) FfiConverterSequenceTypeCommitRow.write(value.commits, into: &buf) FfiConverterUInt32.write(value.laneCount, into: &buf) } } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeCommitPage_lift(_ buf: RustBuffer) throws -> CommitPage { return try FfiConverterTypeCommitPage.lift(buf) } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeCommitPage_lower(_ value: CommitPage) -> RustBuffer { return FfiConverterTypeCommitPage.lower(value) } public struct CommitRow: Equatable, Hashable { public var sha: String public var title: String public var meta: String public var refs: String public var topLanes: [UInt32] public var bottomLanes: [UInt32] public var nodeLane: UInt32? public var connections: [UInt32] // Default memberwise initializers are never public by default, so we // declare one manually. public init(sha: String, title: String, meta: String, refs: String, topLanes: [UInt32], bottomLanes: [UInt32], nodeLane: UInt32?, connections: [UInt32]) { self.sha = sha self.title = title self.meta = meta self.refs = refs self.topLanes = topLanes self.bottomLanes = bottomLanes self.nodeLane = nodeLane self.connections = connections } } #if compiler(>=6) extension CommitRow: Sendable {} #endif #if swift(>=5.8) @_documentation(visibility: private) #endif public struct FfiConverterTypeCommitRow: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> CommitRow { return try CommitRow( sha: FfiConverterString.read(from: &buf), title: FfiConverterString.read(from: &buf), meta: FfiConverterString.read(from: &buf), refs: FfiConverterString.read(from: &buf), topLanes: FfiConverterSequenceUInt32.read(from: &buf), bottomLanes: FfiConverterSequenceUInt32.read(from: &buf), nodeLane: FfiConverterOptionUInt32.read(from: &buf), connections: FfiConverterSequenceUInt32.read(from: &buf) ) } public static func write(_ value: CommitRow, into buf: inout [UInt8]) { FfiConverterString.write(value.sha, into: &buf) FfiConverterString.write(value.title, into: &buf) FfiConverterString.write(value.meta, into: &buf) FfiConverterString.write(value.refs, into: &buf) FfiConverterSequenceUInt32.write(value.topLanes, into: &buf) FfiConverterSequenceUInt32.write(value.bottomLanes, into: &buf) FfiConverterOptionUInt32.write(value.nodeLane, into: &buf) FfiConverterSequenceUInt32.write(value.connections, into: &buf) } } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeCommitRow_lift(_ buf: RustBuffer) throws -> CommitRow { return try FfiConverterTypeCommitRow.lift(buf) } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeCommitRow_lower(_ value: CommitRow) -> RustBuffer { return FfiConverterTypeCommitRow.lower(value) } public struct DiffLine: Equatable, Hashable { public var oldNumber: String public var newNumber: String public var text: String public var kind: String // Default memberwise initializers are never public by default, so we // declare one manually. public init(oldNumber: String, newNumber: String, text: String, kind: String) { self.oldNumber = oldNumber self.newNumber = newNumber self.text = text self.kind = kind } } #if compiler(>=6) extension DiffLine: Sendable {} #endif #if swift(>=5.8) @_documentation(visibility: private) #endif public struct FfiConverterTypeDiffLine: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> DiffLine { return try DiffLine( oldNumber: FfiConverterString.read(from: &buf), newNumber: FfiConverterString.read(from: &buf), text: FfiConverterString.read(from: &buf), kind: FfiConverterString.read(from: &buf) ) } public static func write(_ value: DiffLine, into buf: inout [UInt8]) { FfiConverterString.write(value.oldNumber, into: &buf) FfiConverterString.write(value.newNumber, into: &buf) FfiConverterString.write(value.text, into: &buf) FfiConverterString.write(value.kind, into: &buf) } } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeDiffLine_lift(_ buf: RustBuffer) throws -> DiffLine { return try FfiConverterTypeDiffLine.lift(buf) } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeDiffLine_lower(_ value: DiffLine) -> RustBuffer { return FfiConverterTypeDiffLine.lower(value) } public struct DiffPage: Equatable, Hashable { public var title: String public var columns: UInt32 public var lines: [DiffLine] // Default memberwise initializers are never public by default, so we // declare one manually. public init(title: String, columns: UInt32, lines: [DiffLine]) { self.title = title self.columns = columns self.lines = lines } } #if compiler(>=6) extension DiffPage: Sendable {} #endif #if swift(>=5.8) @_documentation(visibility: private) #endif public struct FfiConverterTypeDiffPage: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> DiffPage { return try DiffPage( title: FfiConverterString.read(from: &buf), columns: FfiConverterUInt32.read(from: &buf), lines: FfiConverterSequenceTypeDiffLine.read(from: &buf) ) } public static func write(_ value: DiffPage, into buf: inout [UInt8]) { FfiConverterString.write(value.title, into: &buf) FfiConverterUInt32.write(value.columns, into: &buf) FfiConverterSequenceTypeDiffLine.write(value.lines, into: &buf) } } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeDiffPage_lift(_ buf: RustBuffer) throws -> DiffPage { return try FfiConverterTypeDiffPage.lift(buf) } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeDiffPage_lower(_ value: DiffPage) -> RustBuffer { return FfiConverterTypeDiffPage.lower(value) } public struct FileRow: Equatable, Hashable { public var path: String public var status: String // Default memberwise initializers are never public by default, so we // declare one manually. public init(path: String, status: String) { self.path = path self.status = status } } #if compiler(>=6) extension FileRow: Sendable {} #endif #if swift(>=5.8) @_documentation(visibility: private) #endif public struct FfiConverterTypeFileRow: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> FileRow { return try FileRow( path: FfiConverterString.read(from: &buf), status: FfiConverterString.read(from: &buf) ) } public static func write(_ value: FileRow, into buf: inout [UInt8]) { FfiConverterString.write(value.path, into: &buf) FfiConverterString.write(value.status, into: &buf) } } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeFileRow_lift(_ buf: RustBuffer) throws -> FileRow { return try FfiConverterTypeFileRow.lift(buf) } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeFileRow_lower(_ value: FileRow) -> RustBuffer { return FfiConverterTypeFileRow.lower(value) } public struct HeatCell: Equatable, Hashable { public var week: UInt32 public var day: UInt32 public var level: UInt32 // Default memberwise initializers are never public by default, so we // declare one manually. public init(week: UInt32, day: UInt32, level: UInt32) { self.week = week self.day = day self.level = level } } #if compiler(>=6) extension HeatCell: Sendable {} #endif #if swift(>=5.8) @_documentation(visibility: private) #endif public struct FfiConverterTypeHeatCell: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> HeatCell { return try HeatCell( week: FfiConverterUInt32.read(from: &buf), day: FfiConverterUInt32.read(from: &buf), level: FfiConverterUInt32.read(from: &buf) ) } public static func write(_ value: HeatCell, into buf: inout [UInt8]) { FfiConverterUInt32.write(value.week, into: &buf) FfiConverterUInt32.write(value.day, into: &buf) FfiConverterUInt32.write(value.level, into: &buf) } } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeHeatCell_lift(_ buf: RustBuffer) throws -> HeatCell { return try FfiConverterTypeHeatCell.lift(buf) } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeHeatCell_lower(_ value: HeatCell) -> RustBuffer { return FfiConverterTypeHeatCell.lower(value) } public struct HomePage: Equatable, Hashable { public var serverName: String public var activities: [ActivityRow] public var heatCells: [HeatCell] public var contributionCount: Int64 // Default memberwise initializers are never public by default, so we // declare one manually. public init(serverName: String, activities: [ActivityRow], heatCells: [HeatCell], contributionCount: Int64) { self.serverName = serverName self.activities = activities self.heatCells = heatCells self.contributionCount = contributionCount } } #if compiler(>=6) extension HomePage: Sendable {} #endif #if swift(>=5.8) @_documentation(visibility: private) #endif public struct FfiConverterTypeHomePage: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> HomePage { return try HomePage( serverName: FfiConverterString.read(from: &buf), activities: FfiConverterSequenceTypeActivityRow.read(from: &buf), heatCells: FfiConverterSequenceTypeHeatCell.read(from: &buf), contributionCount: FfiConverterInt64.read(from: &buf) ) } public static func write(_ value: HomePage, into buf: inout [UInt8]) { FfiConverterString.write(value.serverName, into: &buf) FfiConverterSequenceTypeActivityRow.write(value.activities, into: &buf) FfiConverterSequenceTypeHeatCell.write(value.heatCells, into: &buf) FfiConverterInt64.write(value.contributionCount, into: &buf) } } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeHomePage_lift(_ buf: RustBuffer) throws -> HomePage { return try FfiConverterTypeHomePage.lift(buf) } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeHomePage_lower(_ value: HomePage) -> RustBuffer { return FfiConverterTypeHomePage.lower(value) } public struct IssuePage: Equatable, Hashable { public var title: String public var meta: String public var milestone: String public var body: String public var comments: [CommentRow] // Default memberwise initializers are never public by default, so we // declare one manually. public init(title: String, meta: String, milestone: String, body: String, comments: [CommentRow]) { self.title = title self.meta = meta self.milestone = milestone self.body = body self.comments = comments } } #if compiler(>=6) extension IssuePage: Sendable {} #endif #if swift(>=5.8) @_documentation(visibility: private) #endif public struct FfiConverterTypeIssuePage: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> IssuePage { return try IssuePage( title: FfiConverterString.read(from: &buf), meta: FfiConverterString.read(from: &buf), milestone: FfiConverterString.read(from: &buf), body: FfiConverterString.read(from: &buf), comments: FfiConverterSequenceTypeCommentRow.read(from: &buf) ) } public static func write(_ value: IssuePage, into buf: inout [UInt8]) { FfiConverterString.write(value.title, into: &buf) FfiConverterString.write(value.meta, into: &buf) FfiConverterString.write(value.milestone, into: &buf) FfiConverterString.write(value.body, into: &buf) FfiConverterSequenceTypeCommentRow.write(value.comments, into: &buf) } } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeIssuePage_lift(_ buf: RustBuffer) throws -> IssuePage { return try FfiConverterTypeIssuePage.lift(buf) } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeIssuePage_lower(_ value: IssuePage) -> RustBuffer { return FfiConverterTypeIssuePage.lower(value) } public struct IssueRow: Equatable, Hashable { public var number: Int64 public var title: String public var summary: String public var meta: String public var milestone: String public var labels: [LabelRow] // Default memberwise initializers are never public by default, so we // declare one manually. public init(number: Int64, title: String, summary: String, meta: String, milestone: String, labels: [LabelRow]) { self.number = number self.title = title self.summary = summary self.meta = meta self.milestone = milestone self.labels = labels } } #if compiler(>=6) extension IssueRow: Sendable {} #endif #if swift(>=5.8) @_documentation(visibility: private) #endif public struct FfiConverterTypeIssueRow: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> IssueRow { return try IssueRow( number: FfiConverterInt64.read(from: &buf), title: FfiConverterString.read(from: &buf), summary: FfiConverterString.read(from: &buf), meta: FfiConverterString.read(from: &buf), milestone: FfiConverterString.read(from: &buf), labels: FfiConverterSequenceTypeLabelRow.read(from: &buf) ) } public static func write(_ value: IssueRow, into buf: inout [UInt8]) { FfiConverterInt64.write(value.number, into: &buf) FfiConverterString.write(value.title, into: &buf) FfiConverterString.write(value.summary, into: &buf) FfiConverterString.write(value.meta, into: &buf) FfiConverterString.write(value.milestone, into: &buf) FfiConverterSequenceTypeLabelRow.write(value.labels, into: &buf) } } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeIssueRow_lift(_ buf: RustBuffer) throws -> IssueRow { return try FfiConverterTypeIssueRow.lift(buf) } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeIssueRow_lower(_ value: IssueRow) -> RustBuffer { return FfiConverterTypeIssueRow.lower(value) } public struct LabelRow: Equatable, Hashable { public var name: String public var color: String public var light: Bool // Default memberwise initializers are never public by default, so we // declare one manually. public init(name: String, color: String, light: Bool) { self.name = name self.color = color self.light = light } } #if compiler(>=6) extension LabelRow: Sendable {} #endif #if swift(>=5.8) @_documentation(visibility: private) #endif public struct FfiConverterTypeLabelRow: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LabelRow { return try LabelRow( name: FfiConverterString.read(from: &buf), color: FfiConverterString.read(from: &buf), light: FfiConverterBool.read(from: &buf) ) } public static func write(_ value: LabelRow, into buf: inout [UInt8]) { FfiConverterString.write(value.name, into: &buf) FfiConverterString.write(value.color, into: &buf) FfiConverterBool.write(value.light, into: &buf) } } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeLabelRow_lift(_ buf: RustBuffer) throws -> LabelRow { return try FfiConverterTypeLabelRow.lift(buf) } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeLabelRow_lower(_ value: LabelRow) -> RustBuffer { return FfiConverterTypeLabelRow.lower(value) } public struct MilestonePage: Equatable, Hashable { public var milestone: MilestoneRow public var issues: [IssueRow] // Default memberwise initializers are never public by default, so we // declare one manually. public init(milestone: MilestoneRow, issues: [IssueRow]) { self.milestone = milestone self.issues = issues } } #if compiler(>=6) extension MilestonePage: Sendable {} #endif #if swift(>=5.8) @_documentation(visibility: private) #endif public struct FfiConverterTypeMilestonePage: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MilestonePage { return try MilestonePage( milestone: FfiConverterTypeMilestoneRow.read(from: &buf), issues: FfiConverterSequenceTypeIssueRow.read(from: &buf) ) } public static func write(_ value: MilestonePage, into buf: inout [UInt8]) { FfiConverterTypeMilestoneRow.write(value.milestone, into: &buf) FfiConverterSequenceTypeIssueRow.write(value.issues, into: &buf) } } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeMilestonePage_lift(_ buf: RustBuffer) throws -> MilestonePage { return try FfiConverterTypeMilestonePage.lift(buf) } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeMilestonePage_lower(_ value: MilestonePage) -> RustBuffer { return FfiConverterTypeMilestonePage.lower(value) } public struct MilestoneRow: Equatable, Hashable { public var id: Int64 public var title: String public var description: String public var meta: String public var openIssues: Int64 public var closedIssues: Int64 // Default memberwise initializers are never public by default, so we // declare one manually. public init(id: Int64, title: String, description: String, meta: String, openIssues: Int64, closedIssues: Int64) { self.id = id self.title = title self.description = description self.meta = meta self.openIssues = openIssues self.closedIssues = closedIssues } } #if compiler(>=6) extension MilestoneRow: Sendable {} #endif #if swift(>=5.8) @_documentation(visibility: private) #endif public struct FfiConverterTypeMilestoneRow: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MilestoneRow { return try MilestoneRow( id: FfiConverterInt64.read(from: &buf), title: FfiConverterString.read(from: &buf), description: FfiConverterString.read(from: &buf), meta: FfiConverterString.read(from: &buf), openIssues: FfiConverterInt64.read(from: &buf), closedIssues: FfiConverterInt64.read(from: &buf) ) } public static func write(_ value: MilestoneRow, into buf: inout [UInt8]) { FfiConverterInt64.write(value.id, into: &buf) FfiConverterString.write(value.title, into: &buf) FfiConverterString.write(value.description, into: &buf) FfiConverterString.write(value.meta, into: &buf) FfiConverterInt64.write(value.openIssues, into: &buf) FfiConverterInt64.write(value.closedIssues, into: &buf) } } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeMilestoneRow_lift(_ buf: RustBuffer) throws -> MilestoneRow { return try FfiConverterTypeMilestoneRow.lift(buf) } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeMilestoneRow_lower(_ value: MilestoneRow) -> RustBuffer { return FfiConverterTypeMilestoneRow.lower(value) } public struct PullPage: Equatable, Hashable { public var title: String public var meta: String public var body: String public var filesRef: String public var files: [FileRow] public var comments: [CommentRow] // Default memberwise initializers are never public by default, so we // declare one manually. public init(title: String, meta: String, body: String, filesRef: String, files: [FileRow], comments: [CommentRow]) { self.title = title self.meta = meta self.body = body self.filesRef = filesRef self.files = files self.comments = comments } } #if compiler(>=6) extension PullPage: Sendable {} #endif #if swift(>=5.8) @_documentation(visibility: private) #endif public struct FfiConverterTypePullPage: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PullPage { return try PullPage( title: FfiConverterString.read(from: &buf), meta: FfiConverterString.read(from: &buf), body: FfiConverterString.read(from: &buf), filesRef: FfiConverterString.read(from: &buf), files: FfiConverterSequenceTypeFileRow.read(from: &buf), comments: FfiConverterSequenceTypeCommentRow.read(from: &buf) ) } public static func write(_ value: PullPage, into buf: inout [UInt8]) { FfiConverterString.write(value.title, into: &buf) FfiConverterString.write(value.meta, into: &buf) FfiConverterString.write(value.body, into: &buf) FfiConverterString.write(value.filesRef, into: &buf) FfiConverterSequenceTypeFileRow.write(value.files, into: &buf) FfiConverterSequenceTypeCommentRow.write(value.comments, into: &buf) } } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypePullPage_lift(_ buf: RustBuffer) throws -> PullPage { return try FfiConverterTypePullPage.lift(buf) } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypePullPage_lower(_ value: PullPage) -> RustBuffer { return FfiConverterTypePullPage.lower(value) } public struct PullRow: Equatable, Hashable { public var number: Int64 public var owner: String public var repository: String public var title: String public var summary: String public var meta: String // Default memberwise initializers are never public by default, so we // declare one manually. public init(number: Int64, owner: String, repository: String, title: String, summary: String, meta: String) { self.number = number self.owner = owner self.repository = repository self.title = title self.summary = summary self.meta = meta } } #if compiler(>=6) extension PullRow: Sendable {} #endif #if swift(>=5.8) @_documentation(visibility: private) #endif public struct FfiConverterTypePullRow: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PullRow { return try PullRow( number: FfiConverterInt64.read(from: &buf), owner: FfiConverterString.read(from: &buf), repository: FfiConverterString.read(from: &buf), title: FfiConverterString.read(from: &buf), summary: FfiConverterString.read(from: &buf), meta: FfiConverterString.read(from: &buf) ) } public static func write(_ value: PullRow, into buf: inout [UInt8]) { FfiConverterInt64.write(value.number, into: &buf) FfiConverterString.write(value.owner, into: &buf) FfiConverterString.write(value.repository, into: &buf) FfiConverterString.write(value.title, into: &buf) FfiConverterString.write(value.summary, into: &buf) FfiConverterString.write(value.meta, into: &buf) } } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypePullRow_lift(_ buf: RustBuffer) throws -> PullRow { return try FfiConverterTypePullRow.lift(buf) } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypePullRow_lower(_ value: PullRow) -> RustBuffer { return FfiConverterTypePullRow.lower(value) } public struct RepositoryRow: Equatable, Hashable { public var name: String public var owner: String public var description: String public var meta: String public var favorite: Bool // Default memberwise initializers are never public by default, so we // declare one manually. public init(name: String, owner: String, description: String, meta: String, favorite: Bool) { self.name = name self.owner = owner self.description = description self.meta = meta self.favorite = favorite } } #if compiler(>=6) extension RepositoryRow: Sendable {} #endif #if swift(>=5.8) @_documentation(visibility: private) #endif public struct FfiConverterTypeRepositoryRow: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RepositoryRow { return try RepositoryRow( name: FfiConverterString.read(from: &buf), owner: FfiConverterString.read(from: &buf), description: FfiConverterString.read(from: &buf), meta: FfiConverterString.read(from: &buf), favorite: FfiConverterBool.read(from: &buf) ) } public static func write(_ value: RepositoryRow, into buf: inout [UInt8]) { FfiConverterString.write(value.name, into: &buf) FfiConverterString.write(value.owner, into: &buf) FfiConverterString.write(value.description, into: &buf) FfiConverterString.write(value.meta, into: &buf) FfiConverterBool.write(value.favorite, into: &buf) } } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeRepositoryRow_lift(_ buf: RustBuffer) throws -> RepositoryRow { return try FfiConverterTypeRepositoryRow.lift(buf) } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeRepositoryRow_lower(_ value: RepositoryRow) -> RustBuffer { return FfiConverterTypeRepositoryRow.lower(value) } public struct ServerRow: Equatable, Hashable { public var name: String public var url: String // Default memberwise initializers are never public by default, so we // declare one manually. public init(name: String, url: String) { self.name = name self.url = url } } #if compiler(>=6) extension ServerRow: Sendable {} #endif #if swift(>=5.8) @_documentation(visibility: private) #endif public struct FfiConverterTypeServerRow: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ServerRow { return try ServerRow( name: FfiConverterString.read(from: &buf), url: FfiConverterString.read(from: &buf) ) } public static func write(_ value: ServerRow, into buf: inout [UInt8]) { FfiConverterString.write(value.name, into: &buf) FfiConverterString.write(value.url, into: &buf) } } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeServerRow_lift(_ buf: RustBuffer) throws -> ServerRow { return try FfiConverterTypeServerRow.lift(buf) } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeServerRow_lower(_ value: ServerRow) -> RustBuffer { return FfiConverterTypeServerRow.lower(value) } public struct Settings: Equatable, Hashable { public var issueStatus: String public var pullStatus: String public var appearance: UInt32 // Default memberwise initializers are never public by default, so we // declare one manually. public init(issueStatus: String, pullStatus: String, appearance: UInt32) { self.issueStatus = issueStatus self.pullStatus = pullStatus self.appearance = appearance } } #if compiler(>=6) extension Settings: Sendable {} #endif #if swift(>=5.8) @_documentation(visibility: private) #endif public struct FfiConverterTypeSettings: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Settings { return try Settings( issueStatus: FfiConverterString.read(from: &buf), pullStatus: FfiConverterString.read(from: &buf), appearance: FfiConverterUInt32.read(from: &buf) ) } public static func write(_ value: Settings, into buf: inout [UInt8]) { FfiConverterString.write(value.issueStatus, into: &buf) FfiConverterString.write(value.pullStatus, into: &buf) FfiConverterUInt32.write(value.appearance, into: &buf) } } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeSettings_lift(_ buf: RustBuffer) throws -> Settings { return try FfiConverterTypeSettings.lift(buf) } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeSettings_lower(_ value: Settings) -> RustBuffer { return FfiConverterTypeSettings.lower(value) } public enum GotchaError: Swift.Error, Equatable, Hashable, Foundation.LocalizedError { case Message(message: String ) public var errorDescription: String? { String(reflecting: self) } } #if compiler(>=6) extension GotchaError: Sendable {} #endif #if swift(>=5.8) @_documentation(visibility: private) #endif public struct FfiConverterTypeGotchaError: FfiConverterRustBuffer { typealias SwiftType = GotchaError public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> GotchaError { let variant: Int32 = try readInt(&buf) switch variant { case 1: return .Message( message: try FfiConverterString.read(from: &buf) ) default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: GotchaError, into buf: inout [UInt8]) { switch value { case let .Message(message): writeInt(&buf, Int32(1)) FfiConverterString.write(message, into: &buf) } } } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeGotchaError_lift(_ buf: RustBuffer) throws -> GotchaError { return try FfiConverterTypeGotchaError.lift(buf) } #if swift(>=5.8) @_documentation(visibility: private) #endif public func FfiConverterTypeGotchaError_lower(_ value: GotchaError) -> RustBuffer { return FfiConverterTypeGotchaError.lower(value) } #if swift(>=5.8) @_documentation(visibility: private) #endif fileprivate struct FfiConverterOptionUInt32: FfiConverterRustBuffer { typealias SwiftType = UInt32? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { guard let value = value else { writeInt(&buf, Int8(0)) return } writeInt(&buf, Int8(1)) FfiConverterUInt32.write(value, into: &buf) } public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { switch try readInt(&buf) as Int8 { case 0: return nil case 1: return try FfiConverterUInt32.read(from: &buf) default: throw UniffiInternalError.unexpectedOptionalTag } } } #if swift(>=5.8) @_documentation(visibility: private) #endif fileprivate struct FfiConverterOptionString: FfiConverterRustBuffer { typealias SwiftType = String? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { guard let value = value else { writeInt(&buf, Int8(0)) return } writeInt(&buf, Int8(1)) FfiConverterString.write(value, into: &buf) } public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType { switch try readInt(&buf) as Int8 { case 0: return nil case 1: return try FfiConverterString.read(from: &buf) default: throw UniffiInternalError.unexpectedOptionalTag } } } #if swift(>=5.8) @_documentation(visibility: private) #endif fileprivate struct FfiConverterSequenceUInt32: FfiConverterRustBuffer { typealias SwiftType = [UInt32] public static func write(_ value: [UInt32], into buf: inout [UInt8]) { let len = Int32(value.count) writeInt(&buf, len) for item in value { FfiConverterUInt32.write(item, into: &buf) } } public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [UInt32] { let len: Int32 = try readInt(&buf) var seq = [UInt32]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { seq.append(try FfiConverterUInt32.read(from: &buf)) } return seq } } #if swift(>=5.8) @_documentation(visibility: private) #endif fileprivate struct FfiConverterSequenceString: FfiConverterRustBuffer { typealias SwiftType = [String] public static func write(_ value: [String], into buf: inout [UInt8]) { let len = Int32(value.count) writeInt(&buf, len) for item in value { FfiConverterString.write(item, into: &buf) } } public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [String] { let len: Int32 = try readInt(&buf) var seq = [String]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { seq.append(try FfiConverterString.read(from: &buf)) } return seq } } #if swift(>=5.8) @_documentation(visibility: private) #endif fileprivate struct FfiConverterSequenceTypeActivityRow: FfiConverterRustBuffer { typealias SwiftType = [ActivityRow] public static func write(_ value: [ActivityRow], into buf: inout [UInt8]) { let len = Int32(value.count) writeInt(&buf, len) for item in value { FfiConverterTypeActivityRow.write(item, into: &buf) } } public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [ActivityRow] { let len: Int32 = try readInt(&buf) var seq = [ActivityRow]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { seq.append(try FfiConverterTypeActivityRow.read(from: &buf)) } return seq } } #if swift(>=5.8) @_documentation(visibility: private) #endif fileprivate struct FfiConverterSequenceTypeCommentRow: FfiConverterRustBuffer { typealias SwiftType = [CommentRow] public static func write(_ value: [CommentRow], into buf: inout [UInt8]) { let len = Int32(value.count) writeInt(&buf, len) for item in value { FfiConverterTypeCommentRow.write(item, into: &buf) } } public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [CommentRow] { let len: Int32 = try readInt(&buf) var seq = [CommentRow]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { seq.append(try FfiConverterTypeCommentRow.read(from: &buf)) } return seq } } #if swift(>=5.8) @_documentation(visibility: private) #endif fileprivate struct FfiConverterSequenceTypeCommitRow: FfiConverterRustBuffer { typealias SwiftType = [CommitRow] public static func write(_ value: [CommitRow], into buf: inout [UInt8]) { let len = Int32(value.count) writeInt(&buf, len) for item in value { FfiConverterTypeCommitRow.write(item, into: &buf) } } public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [CommitRow] { let len: Int32 = try readInt(&buf) var seq = [CommitRow]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { seq.append(try FfiConverterTypeCommitRow.read(from: &buf)) } return seq } } #if swift(>=5.8) @_documentation(visibility: private) #endif fileprivate struct FfiConverterSequenceTypeDiffLine: FfiConverterRustBuffer { typealias SwiftType = [DiffLine] public static func write(_ value: [DiffLine], into buf: inout [UInt8]) { let len = Int32(value.count) writeInt(&buf, len) for item in value { FfiConverterTypeDiffLine.write(item, into: &buf) } } public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [DiffLine] { let len: Int32 = try readInt(&buf) var seq = [DiffLine]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { seq.append(try FfiConverterTypeDiffLine.read(from: &buf)) } return seq } } #if swift(>=5.8) @_documentation(visibility: private) #endif fileprivate struct FfiConverterSequenceTypeFileRow: FfiConverterRustBuffer { typealias SwiftType = [FileRow] public static func write(_ value: [FileRow], into buf: inout [UInt8]) { let len = Int32(value.count) writeInt(&buf, len) for item in value { FfiConverterTypeFileRow.write(item, into: &buf) } } public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [FileRow] { let len: Int32 = try readInt(&buf) var seq = [FileRow]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { seq.append(try FfiConverterTypeFileRow.read(from: &buf)) } return seq } } #if swift(>=5.8) @_documentation(visibility: private) #endif fileprivate struct FfiConverterSequenceTypeHeatCell: FfiConverterRustBuffer { typealias SwiftType = [HeatCell] public static func write(_ value: [HeatCell], into buf: inout [UInt8]) { let len = Int32(value.count) writeInt(&buf, len) for item in value { FfiConverterTypeHeatCell.write(item, into: &buf) } } public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [HeatCell] { let len: Int32 = try readInt(&buf) var seq = [HeatCell]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { seq.append(try FfiConverterTypeHeatCell.read(from: &buf)) } return seq } } #if swift(>=5.8) @_documentation(visibility: private) #endif fileprivate struct FfiConverterSequenceTypeIssueRow: FfiConverterRustBuffer { typealias SwiftType = [IssueRow] public static func write(_ value: [IssueRow], into buf: inout [UInt8]) { let len = Int32(value.count) writeInt(&buf, len) for item in value { FfiConverterTypeIssueRow.write(item, into: &buf) } } public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [IssueRow] { let len: Int32 = try readInt(&buf) var seq = [IssueRow]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { seq.append(try FfiConverterTypeIssueRow.read(from: &buf)) } return seq } } #if swift(>=5.8) @_documentation(visibility: private) #endif fileprivate struct FfiConverterSequenceTypeLabelRow: FfiConverterRustBuffer { typealias SwiftType = [LabelRow] public static func write(_ value: [LabelRow], into buf: inout [UInt8]) { let len = Int32(value.count) writeInt(&buf, len) for item in value { FfiConverterTypeLabelRow.write(item, into: &buf) } } public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [LabelRow] { let len: Int32 = try readInt(&buf) var seq = [LabelRow]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { seq.append(try FfiConverterTypeLabelRow.read(from: &buf)) } return seq } } #if swift(>=5.8) @_documentation(visibility: private) #endif fileprivate struct FfiConverterSequenceTypeMilestoneRow: FfiConverterRustBuffer { typealias SwiftType = [MilestoneRow] public static func write(_ value: [MilestoneRow], into buf: inout [UInt8]) { let len = Int32(value.count) writeInt(&buf, len) for item in value { FfiConverterTypeMilestoneRow.write(item, into: &buf) } } public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [MilestoneRow] { let len: Int32 = try readInt(&buf) var seq = [MilestoneRow]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { seq.append(try FfiConverterTypeMilestoneRow.read(from: &buf)) } return seq } } #if swift(>=5.8) @_documentation(visibility: private) #endif fileprivate struct FfiConverterSequenceTypePullRow: FfiConverterRustBuffer { typealias SwiftType = [PullRow] public static func write(_ value: [PullRow], into buf: inout [UInt8]) { let len = Int32(value.count) writeInt(&buf, len) for item in value { FfiConverterTypePullRow.write(item, into: &buf) } } public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [PullRow] { let len: Int32 = try readInt(&buf) var seq = [PullRow]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { seq.append(try FfiConverterTypePullRow.read(from: &buf)) } return seq } } #if swift(>=5.8) @_documentation(visibility: private) #endif fileprivate struct FfiConverterSequenceTypeRepositoryRow: FfiConverterRustBuffer { typealias SwiftType = [RepositoryRow] public static func write(_ value: [RepositoryRow], into buf: inout [UInt8]) { let len = Int32(value.count) writeInt(&buf, len) for item in value { FfiConverterTypeRepositoryRow.write(item, into: &buf) } } public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [RepositoryRow] { let len: Int32 = try readInt(&buf) var seq = [RepositoryRow]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { seq.append(try FfiConverterTypeRepositoryRow.read(from: &buf)) } return seq } } #if swift(>=5.8) @_documentation(visibility: private) #endif fileprivate struct FfiConverterSequenceTypeServerRow: FfiConverterRustBuffer { typealias SwiftType = [ServerRow] public static func write(_ value: [ServerRow], into buf: inout [UInt8]) { let len = Int32(value.count) writeInt(&buf, len) for item in value { FfiConverterTypeServerRow.write(item, into: &buf) } } public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [ServerRow] { let len: Int32 = try readInt(&buf) var seq = [ServerRow]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { seq.append(try FfiConverterTypeServerRow.read(from: &buf)) } return seq } } private let UNIFFI_RUST_FUTURE_POLL_READY: Int8 = 0 private let UNIFFI_RUST_FUTURE_POLL_WAKE: Int8 = 1 fileprivate let uniffiContinuationHandleMap = UniffiHandleMap>() fileprivate func uniffiRustCallAsync( rustFutureFunc: () -> UInt64, pollFunc: (UInt64, @escaping UniffiRustFutureContinuationCallback, UInt64) -> (), completeFunc: (UInt64, UnsafeMutablePointer) -> F, freeFunc: (UInt64) -> (), liftFunc: (F) throws -> T, errorHandler: ((RustBuffer) throws -> Swift.Error)? ) async throws -> T { // Make sure to call the ensure init function since future creation doesn't have a // RustCallStatus param, so doesn't use makeRustCall() uniffiEnsureGotchaCoreInitialized() let rustFuture = rustFutureFunc() defer { freeFunc(rustFuture) } var pollResult: Int8; repeat { pollResult = await withUnsafeContinuation { pollFunc( rustFuture, { handle, pollResult in uniffiFutureContinuationCallback(handle: handle, pollResult: pollResult) }, uniffiContinuationHandleMap.insert(obj: $0) ) } } while pollResult != UNIFFI_RUST_FUTURE_POLL_READY return try liftFunc(makeRustCall( { completeFunc(rustFuture, $0) }, errorHandler: errorHandler )) } // Callback handlers for an async calls. These are invoked by Rust when the future is ready. They // lift the return value or error and resume the suspended function. fileprivate func uniffiFutureContinuationCallback(handle: UInt64, pollResult: Int8) { if let continuation = try? uniffiContinuationHandleMap.remove(handle: handle) { continuation.resume(returning: pollResult) } else { print("uniffiFutureContinuationCallback invalid handle") } } private enum InitializationResult { case ok case contractVersionMismatch case apiChecksumMismatch } // Use a global variable to perform the versioning checks. Swift ensures that // the code inside is only computed once. private let initializationResult: InitializationResult = { // Get the bindings contract version from our ComponentInterface let bindings_contract_version = 30 // Get the scaffolding contract version by calling the into the dylib let scaffolding_contract_version = ffi_gotcha_core_uniffi_contract_version() if bindings_contract_version != scaffolding_contract_version { return InitializationResult.contractVersionMismatch } if (uniffi_gotcha_core_checksum_method_gotchacore_active_server_index() != 48940) { return InitializationResult.apiChecksumMismatch } if (uniffi_gotcha_core_checksum_method_gotchacore_active_server_name() != 62299) { return InitializationResult.apiChecksumMismatch } if (uniffi_gotcha_core_checksum_method_gotchacore_add_server() != 42705) { return InitializationResult.apiChecksumMismatch } if (uniffi_gotcha_core_checksum_method_gotchacore_commit_diff() != 56887) { return InitializationResult.apiChecksumMismatch } if (uniffi_gotcha_core_checksum_method_gotchacore_commit_files() != 43926) { return InitializationResult.apiChecksumMismatch } if (uniffi_gotcha_core_checksum_method_gotchacore_commits() != 472) { return InitializationResult.apiChecksumMismatch } if (uniffi_gotcha_core_checksum_method_gotchacore_home() != 5983) { return InitializationResult.apiChecksumMismatch } if (uniffi_gotcha_core_checksum_method_gotchacore_issue() != 56735) { return InitializationResult.apiChecksumMismatch } if (uniffi_gotcha_core_checksum_method_gotchacore_issues() != 1316) { return InitializationResult.apiChecksumMismatch } if (uniffi_gotcha_core_checksum_method_gotchacore_milestone() != 26979) { return InitializationResult.apiChecksumMismatch } if (uniffi_gotcha_core_checksum_method_gotchacore_milestones() != 27282) { return InitializationResult.apiChecksumMismatch } if (uniffi_gotcha_core_checksum_method_gotchacore_pull() != 46939) { return InitializationResult.apiChecksumMismatch } if (uniffi_gotcha_core_checksum_method_gotchacore_pull_diff() != 61384) { return InitializationResult.apiChecksumMismatch } if (uniffi_gotcha_core_checksum_method_gotchacore_pulls() != 13092) { return InitializationResult.apiChecksumMismatch } if (uniffi_gotcha_core_checksum_method_gotchacore_repositories() != 12256) { return InitializationResult.apiChecksumMismatch } if (uniffi_gotcha_core_checksum_method_gotchacore_select_server() != 22721) { return InitializationResult.apiChecksumMismatch } if (uniffi_gotcha_core_checksum_method_gotchacore_servers() != 2778) { return InitializationResult.apiChecksumMismatch } if (uniffi_gotcha_core_checksum_method_gotchacore_set_appearance() != 61293) { return InitializationResult.apiChecksumMismatch } if (uniffi_gotcha_core_checksum_method_gotchacore_set_issue_status() != 44445) { return InitializationResult.apiChecksumMismatch } if (uniffi_gotcha_core_checksum_method_gotchacore_set_pull_status() != 1356) { return InitializationResult.apiChecksumMismatch } if (uniffi_gotcha_core_checksum_method_gotchacore_settings() != 59418) { return InitializationResult.apiChecksumMismatch } if (uniffi_gotcha_core_checksum_method_gotchacore_startup_error() != 56765) { return InitializationResult.apiChecksumMismatch } if (uniffi_gotcha_core_checksum_method_gotchacore_toggle_favorite() != 26694) { return InitializationResult.apiChecksumMismatch } if (uniffi_gotcha_core_checksum_constructor_gotchacore_new() != 35775) { return InitializationResult.apiChecksumMismatch } return InitializationResult.ok }() // Make the ensure init function public so that other modules which have external type references to // our types can call it. public func uniffiEnsureGotchaCoreInitialized() { switch initializationResult { case .ok: break case .contractVersionMismatch: fatalError("UniFFI contract version mismatch: try cleaning and rebuilding your project") case .apiChecksumMismatch: fatalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } } // swiftlint:enable all