diff --git a/AutomergeUniffi/automerge.swift b/AutomergeUniffi/automerge.swift index d08c76e2..14c232a9 100644 --- a/AutomergeUniffi/automerge.swift +++ b/AutomergeUniffi/automerge.swift @@ -9,7 +9,7 @@ import Foundation import automergeFFI #endif -fileprivate extension RustBuffer { +private extension RustBuffer { // Allocate a new buffer, copying the contents of a `UInt8` array. init(bytes: [UInt8]) { let rbuf = bytes.withUnsafeBufferPointer { ptr in @@ -29,7 +29,7 @@ fileprivate extension RustBuffer { } } -fileprivate extension ForeignBytes { +private extension ForeignBytes { init(bufferPointer: UnsafeBufferPointer) { self.init(len: Int32(bufferPointer.count), data: bufferPointer.baseAddress) } @@ -42,7 +42,7 @@ fileprivate extension ForeignBytes { // Helper classes/extensions that don't change. // Someday, this will be in a library of its own. -fileprivate extension Data { +private extension Data { init(rustBuffer: RustBuffer) { // TODO: This copies the buffer. Can we read directly from a // Rust buffer? @@ -64,15 +64,15 @@ fileprivate extension Data { // // Instead, the read() method and these helper functions input a tuple of data -fileprivate func createReader(data: Data) -> (data: Data, offset: Data.Index) { +private 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 +private func readInt(_ reader: inout (data: Data, offset: Data.Index)) throws -> T { + let range = reader.offset ..< reader.offset + MemoryLayout.size guard reader.data.count >= range.upperBound else { throw UniffiInternalError.bufferOverflow } @@ -82,50 +82,50 @@ fileprivate func readInt(_ reader: inout (data: Data, offs return value as! T } var value: T = 0 - let _ = withUnsafeMutableBytes(of: &value, { reader.data.copyBytes(to: $0, from: range)}) + 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) +private func readBytes(_ reader: inout (data: Data, offset: Data.Index), count: Int) throws -> [UInt8] { + 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 + 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)) +private func readFloat(_ reader: inout (data: Data, offset: Data.Index)) throws -> Float { + try Float(bitPattern: 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)) +private func readDouble(_ reader: inout (data: Data, offset: Data.Index)) throws -> Double { + try Double(bitPattern: 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 +private func hasRemaining(_ reader: (data: Data, offset: Data.Index)) -> Bool { + 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 [] +private func createWriter() -> [UInt8] { + [] } -fileprivate func writeBytes(_ writer: inout [UInt8], _ byteArr: S) where S: Sequence, S.Element == UInt8 { +private func writeBytes(_ writer: inout [UInt8], _ byteArr: S) where S: Sequence, S.Element == UInt8 { writer.append(contentsOf: byteArr) } @@ -133,22 +133,22 @@ fileprivate func writeBytes(_ writer: inout [UInt8], _ byteArr: S) where S: S // // Warning: make sure what you are trying to write // is in the correct type! -fileprivate func writeInt(_ writer: inout [UInt8], _ value: T) { +private 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) { +private func writeFloat(_ writer: inout [UInt8], _ value: Float) { writeInt(&writer, value.bitPattern) } -fileprivate func writeDouble(_ writer: inout [UInt8], _ value: Double) { +private func writeDouble(_ writer: inout [UInt8], _ value: Double) { writeInt(&writer, value.bitPattern) } // Protocol for types that transfer other types across the FFI. This is // analogous go the Rust trait of the same name. -fileprivate protocol FfiConverter { +private protocol FfiConverter { associatedtype FfiType associatedtype SwiftType @@ -159,21 +159,21 @@ fileprivate protocol FfiConverter { } // Types conforming to `Primitive` pass themselves directly over the FFI. -fileprivate protocol FfiConverterPrimitive: FfiConverter where FfiType == SwiftType { } +private protocol FfiConverterPrimitive: FfiConverter where FfiType == SwiftType {} extension FfiConverterPrimitive { public static func lift(_ value: FfiType) throws -> SwiftType { - return value + value } public static func lower(_ value: SwiftType) -> FfiType { - return value + 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 {} +private protocol FfiConverterRustBuffer: FfiConverter where FfiType == RustBuffer {} extension FfiConverterRustBuffer { public static func lift(_ buf: RustBuffer) throws -> SwiftType { @@ -187,14 +187,15 @@ extension FfiConverterRustBuffer { } public static func lower(_ value: SwiftType) -> RustBuffer { - var writer = createWriter() - write(value, into: &writer) - return RustBuffer(bytes: writer) + 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 { +private enum UniffiInternalError: LocalizedError { case bufferOverflow case incompleteData case unexpectedOptionalTag @@ -220,15 +221,15 @@ fileprivate enum UniffiInternalError: LocalizedError { } } -fileprivate let CALL_SUCCESS: Int8 = 0 -fileprivate let CALL_ERROR: Int8 = 1 -fileprivate let CALL_PANIC: Int8 = 2 +private let CALL_SUCCESS: Int8 = 0 +private let CALL_ERROR: Int8 = 1 +private let CALL_PANIC: Int8 = 2 -fileprivate extension RustCallStatus { +private extension RustCallStatus { init() { self.init( code: CALL_SUCCESS, - errorBuf: RustBuffer.init( + errorBuf: RustBuffer( capacity: 0, len: 0, data: nil @@ -243,7 +244,8 @@ private func rustCall(_ callback: (UnsafeMutablePointer) -> T private func rustCallWithError( _ errorHandler: @escaping (RustBuffer) throws -> Error, - _ callback: (UnsafeMutablePointer) -> T) throws -> T { + _ callback: (UnsafeMutablePointer) -> T +) throws -> T { try makeRustCall(callback, errorHandler: errorHandler) } @@ -252,7 +254,7 @@ private func makeRustCall( errorHandler: ((RustBuffer) throws -> Error)? ) throws -> T { uniffiEnsureInitialized() - var callStatus = RustCallStatus.init() + var callStatus = RustCallStatus() let returnedVal = callback(&callStatus) try uniffiCheckCallStatus(callStatus: callStatus, errorHandler: errorHandler) return returnedVal @@ -263,42 +265,41 @@ private func uniffiCheckCallStatus( errorHandler: ((RustBuffer) throws -> Error)? ) throws { switch callStatus.code { - case CALL_SUCCESS: - return + 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_ERROR: + if let errorHandler = errorHandler { + throw try errorHandler(callStatus.errorBuf) + } else { + callStatus.errorBuf.deallocate() + throw UniffiInternalError.unexpectedRustCallError + } - case CALL_PANIC: - // 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_PANIC: + // 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 try UniffiInternalError.rustPanic(FfiConverterString.lift(callStatus.errorBuf)) + } else { + callStatus.errorBuf.deallocate() + throw UniffiInternalError.rustPanic("Rust panic") + } - default: - throw UniffiInternalError.unexpectedRustCallStatusCode + default: + throw UniffiInternalError.unexpectedRustCallStatusCode } } // Public interface members begin here. - -fileprivate struct FfiConverterUInt8: FfiConverterPrimitive { +private struct FfiConverterUInt8: FfiConverterPrimitive { typealias FfiType = UInt8 typealias SwiftType = UInt8 public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UInt8 { - return try lift(readInt(&buf)) + try lift(readInt(&buf)) } public static func write(_ value: UInt8, into buf: inout [UInt8]) { @@ -306,12 +307,12 @@ fileprivate struct FfiConverterUInt8: FfiConverterPrimitive { } } -fileprivate struct FfiConverterUInt64: FfiConverterPrimitive { +private struct FfiConverterUInt64: FfiConverterPrimitive { typealias FfiType = UInt64 typealias SwiftType = UInt64 public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UInt64 { - return try lift(readInt(&buf)) + try lift(readInt(&buf)) } public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -319,12 +320,12 @@ fileprivate struct FfiConverterUInt64: FfiConverterPrimitive { } } -fileprivate struct FfiConverterInt64: FfiConverterPrimitive { +private 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)) + try lift(readInt(&buf)) } public static func write(_ value: Int64, into buf: inout [UInt8]) { @@ -332,12 +333,12 @@ fileprivate struct FfiConverterInt64: FfiConverterPrimitive { } } -fileprivate struct FfiConverterDouble: FfiConverterPrimitive { +private struct FfiConverterDouble: FfiConverterPrimitive { typealias FfiType = Double typealias SwiftType = Double public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Double { - return try lift(readDouble(&buf)) + try lift(readDouble(&buf)) } public static func write(_ value: Double, into buf: inout [UInt8]) { @@ -345,20 +346,20 @@ fileprivate struct FfiConverterDouble: FfiConverterPrimitive { } } -fileprivate struct FfiConverterBool : FfiConverter { +private struct FfiConverterBool: FfiConverter { typealias FfiType = Int8 typealias SwiftType = Bool public static func lift(_ value: Int8) throws -> Bool { - return value != 0 + value != 0 } public static func lower(_ value: Bool) -> Int8 { - return value ? 1 : 0 + value ? 1 : 0 } public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Bool { - return try lift(readInt(&buf)) + try lift(readInt(&buf)) } public static func write(_ value: Bool, into buf: inout [UInt8]) { @@ -366,7 +367,7 @@ fileprivate struct FfiConverterBool : FfiConverter { } } -fileprivate struct FfiConverterString: FfiConverter { +private struct FfiConverterString: FfiConverter { typealias SwiftType = String typealias FfiType = RustBuffer @@ -382,7 +383,7 @@ fileprivate struct FfiConverterString: FfiConverter { } public static func lower(_ value: String) -> RustBuffer { - return value.utf8CString.withUnsafeBufferPointer { ptr in + 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. @@ -394,7 +395,7 @@ fileprivate struct FfiConverterString: FfiConverter { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> String { let len: Int32 = try readInt(&buf) - return String(bytes: try readBytes(&buf, count: Int(len)), encoding: String.Encoding.utf8)! + return try String(bytes: readBytes(&buf, count: Int(len)), encoding: String.Encoding.utf8)! } public static func write(_ value: String, into buf: inout [UInt8]) { @@ -404,64 +405,62 @@ fileprivate struct FfiConverterString: FfiConverter { } } - public protocol DocProtocol { - func `actorId`() -> ActorId - func `setActor`(`actor`: ActorId) - func `fork`() -> Doc - func `forkAt`(`heads`: [ChangeHash]) throws -> Doc - func `putInMap`(`obj`: ObjId, `key`: String, `value`: ScalarValue) throws - func `putObjectInMap`(`obj`: ObjId, `key`: String, `objType`: ObjType) throws -> ObjId - func `putInList`(`obj`: ObjId, `index`: UInt64, `value`: ScalarValue) throws - func `putObjectInList`(`obj`: ObjId, `index`: UInt64, `objType`: ObjType) throws -> ObjId - func `insertInList`(`obj`: ObjId, `index`: UInt64, `value`: ScalarValue) throws - func `insertObjectInList`(`obj`: ObjId, `index`: UInt64, `objType`: ObjType) throws -> ObjId - func `spliceText`(`obj`: ObjId, `start`: UInt64, `delete`: Int64, `chars`: String) throws - func `splice`(`obj`: ObjId, `start`: UInt64, `delete`: Int64, `values`: [ScalarValue]) throws - func `mark`(`obj`: ObjId, `start`: UInt64, `end`: UInt64, `expand`: ExpandMark, `name`: String, `value`: ScalarValue) throws - func `marks`(`obj`: ObjId) throws -> [Mark] - func `marksAt`(`obj`: ObjId, `heads`: [ChangeHash]) throws -> [Mark] - func `deleteInMap`(`obj`: ObjId, `key`: String) throws - func `deleteInList`(`obj`: ObjId, `index`: UInt64) throws - func `incrementInMap`(`obj`: ObjId, `key`: String, `by`: Int64) throws - func `incrementInList`(`obj`: ObjId, `index`: UInt64, `by`: Int64) throws - func `getInMap`(`obj`: ObjId, `key`: String) throws -> Value? - func `getInList`(`obj`: ObjId, `index`: UInt64) throws -> Value? - func `getAtInMap`(`obj`: ObjId, `key`: String, `heads`: [ChangeHash]) throws -> Value? - func `getAtInList`(`obj`: ObjId, `index`: UInt64, `heads`: [ChangeHash]) throws -> Value? - func `getAllInMap`(`obj`: ObjId, `key`: String) throws -> [Value] - func `getAllInList`(`obj`: ObjId, `index`: UInt64) throws -> [Value] - func `getAllAtInMap`(`obj`: ObjId, `key`: String, `heads`: [ChangeHash]) throws -> [Value] - func `getAllAtInList`(`obj`: ObjId, `index`: UInt64, `heads`: [ChangeHash]) throws -> [Value] - func `text`(`obj`: ObjId) throws -> String - func `textAt`(`obj`: ObjId, `heads`: [ChangeHash]) throws -> String - func `mapKeys`(`obj`: ObjId) -> [String] - func `mapKeysAt`(`obj`: ObjId, `heads`: [ChangeHash]) -> [String] - func `mapEntries`(`obj`: ObjId) throws -> [KeyValue] - func `mapEntriesAt`(`obj`: ObjId, `heads`: [ChangeHash]) throws -> [KeyValue] - func `values`(`obj`: ObjId) throws -> [Value] - func `valuesAt`(`obj`: ObjId, `heads`: [ChangeHash]) throws -> [Value] - func `length`(`obj`: ObjId) -> UInt64 - func `lengthAt`(`obj`: ObjId, `heads`: [ChangeHash]) -> UInt64 - func `objectType`(`obj`: ObjId) -> ObjType - func `path`(`obj`: ObjId) throws -> [PathElement] - func `heads`() -> [ChangeHash] - func `changes`() -> [ChangeHash] - func `save`() -> [UInt8] - func `merge`(`other`: Doc) throws - func `mergeWithPatches`(`other`: Doc) throws -> [Patch] - func `generateSyncMessage`(`state`: SyncState) -> [UInt8]? - func `receiveSyncMessage`(`state`: SyncState, `msg`: [UInt8]) throws - func `receiveSyncMessageWithPatches`(`state`: SyncState, `msg`: [UInt8]) throws -> [Patch] - func `encodeNewChanges`() -> [UInt8] - func `encodeChangesSince`(`heads`: [ChangeHash]) throws -> [UInt8] - func `applyEncodedChanges`(`changes`: [UInt8]) throws - func `applyEncodedChangesWithPatches`(`changes`: [UInt8]) throws -> [Patch] - func `cursor`(`obj`: ObjId, `position`: UInt64) throws -> Cursor - func `cursorAt`(`obj`: ObjId, `position`: UInt64, `heads`: [ChangeHash]) throws -> Cursor - func `cursorPosition`(`obj`: ObjId, `cursor`: Cursor) throws -> UInt64 - func `cursorPositionAt`(`obj`: ObjId, `cursor`: Cursor, `heads`: [ChangeHash]) throws -> UInt64 - + func actorId() -> ActorId + func setActor(actor: ActorId) + func fork() -> Doc + func forkAt(heads: [ChangeHash]) throws -> Doc + func putInMap(obj: ObjId, key: String, value: ScalarValue) throws + func putObjectInMap(obj: ObjId, key: String, objType: ObjType) throws -> ObjId + func putInList(obj: ObjId, index: UInt64, value: ScalarValue) throws + func putObjectInList(obj: ObjId, index: UInt64, objType: ObjType) throws -> ObjId + func insertInList(obj: ObjId, index: UInt64, value: ScalarValue) throws + func insertObjectInList(obj: ObjId, index: UInt64, objType: ObjType) throws -> ObjId + func spliceText(obj: ObjId, start: UInt64, delete: Int64, chars: String) throws + func splice(obj: ObjId, start: UInt64, delete: Int64, values: [ScalarValue]) throws + func mark(obj: ObjId, start: UInt64, end: UInt64, expand: ExpandMark, name: String, value: ScalarValue) throws + func marks(obj: ObjId) throws -> [Mark] + func marksAt(obj: ObjId, heads: [ChangeHash]) throws -> [Mark] + func deleteInMap(obj: ObjId, key: String) throws + func deleteInList(obj: ObjId, index: UInt64) throws + func incrementInMap(obj: ObjId, key: String, by: Int64) throws + func incrementInList(obj: ObjId, index: UInt64, by: Int64) throws + func getInMap(obj: ObjId, key: String) throws -> Value? + func getInList(obj: ObjId, index: UInt64) throws -> Value? + func getAtInMap(obj: ObjId, key: String, heads: [ChangeHash]) throws -> Value? + func getAtInList(obj: ObjId, index: UInt64, heads: [ChangeHash]) throws -> Value? + func getAllInMap(obj: ObjId, key: String) throws -> [Value] + func getAllInList(obj: ObjId, index: UInt64) throws -> [Value] + func getAllAtInMap(obj: ObjId, key: String, heads: [ChangeHash]) throws -> [Value] + func getAllAtInList(obj: ObjId, index: UInt64, heads: [ChangeHash]) throws -> [Value] + func text(obj: ObjId) throws -> String + func textAt(obj: ObjId, heads: [ChangeHash]) throws -> String + func mapKeys(obj: ObjId) -> [String] + func mapKeysAt(obj: ObjId, heads: [ChangeHash]) -> [String] + func mapEntries(obj: ObjId) throws -> [KeyValue] + func mapEntriesAt(obj: ObjId, heads: [ChangeHash]) throws -> [KeyValue] + func values(obj: ObjId) throws -> [Value] + func valuesAt(obj: ObjId, heads: [ChangeHash]) throws -> [Value] + func length(obj: ObjId) -> UInt64 + func lengthAt(obj: ObjId, heads: [ChangeHash]) -> UInt64 + func objectType(obj: ObjId) -> ObjType + func path(obj: ObjId) throws -> [PathElement] + func heads() -> [ChangeHash] + func changes() -> [ChangeHash] + func save() -> [UInt8] + func merge(other: Doc) throws + func mergeWithPatches(other: Doc) throws -> [Patch] + func generateSyncMessage(state: SyncState) -> [UInt8]? + func receiveSyncMessage(state: SyncState, msg: [UInt8]) throws + func receiveSyncMessageWithPatches(state: SyncState, msg: [UInt8]) throws -> [Patch] + func encodeNewChanges() -> [UInt8] + func encodeChangesSince(heads: [ChangeHash]) throws -> [UInt8] + func applyEncodedChanges(changes: [UInt8]) throws + func applyEncodedChangesWithPatches(changes: [UInt8]) throws -> [Patch] + func cursor(obj: ObjId, position: UInt64) throws -> Cursor + func cursorAt(obj: ObjId, position: UInt64, heads: [ChangeHash]) throws -> Cursor + func cursorPosition(obj: ObjId, cursor: Cursor) throws -> UInt64 + func cursorPositionAt(obj: ObjId, cursor: Cursor, heads: [ChangeHash]) throws -> UInt64 } public class Doc: DocProtocol { @@ -473,675 +472,793 @@ public class Doc: DocProtocol { required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } - public convenience init() { - self.init(unsafeFromRawPointer: try! rustCall() { - uniffi_automerge_fn_constructor_doc_new($0) -}) + + public convenience init() { + self.init(unsafeFromRawPointer: try! rustCall { + uniffi_automerge_fn_constructor_doc_new($0) + }) } deinit { try! rustCall { uniffi_automerge_fn_free_doc(pointer, $0) } } - - - public static func `newWithActor`(`actor`: ActorId) -> Doc { - return Doc(unsafeFromRawPointer: try! rustCall() { - uniffi_automerge_fn_constructor_doc_new_with_actor( - FfiConverterTypeActorId.lower(`actor`),$0) -}) + public static func newWithActor(actor: ActorId) -> Doc { + Doc(unsafeFromRawPointer: try! rustCall { + uniffi_automerge_fn_constructor_doc_new_with_actor( + FfiConverterTypeActorId.lower(`actor`), $0 + ) + }) } - - - public static func `load`(`bytes`: [UInt8]) throws -> Doc { - return Doc(unsafeFromRawPointer: try rustCallWithError(FfiConverterTypeLoadError.lift) { - uniffi_automerge_fn_constructor_doc_load( - FfiConverterSequenceUInt8.lower(`bytes`),$0) -}) + public static func load(bytes: [UInt8]) throws -> Doc { + try Doc(unsafeFromRawPointer: rustCallWithError(FfiConverterTypeLoadError.lift) { + uniffi_automerge_fn_constructor_doc_load( + FfiConverterSequenceUInt8.lower(bytes), $0 + ) + }) } - - - - - - public func `actorId`() -> ActorId { - return try! FfiConverterTypeActorId.lift( - try! - rustCall() { - - uniffi_automerge_fn_method_doc_actor_id(self.pointer, $0 - ) -} + public func actorId() -> ActorId { + try! FfiConverterTypeActorId.lift( + try! + rustCall { + uniffi_automerge_fn_method_doc_actor_id( + self.pointer, + $0 + ) + } ) } - public func `setActor`(`actor`: ActorId) { - try! - rustCall() { - - uniffi_automerge_fn_method_doc_set_actor(self.pointer, - FfiConverterTypeActorId.lower(`actor`),$0 - ) -} + public func setActor(actor: ActorId) { + try! + rustCall { + uniffi_automerge_fn_method_doc_set_actor( + self.pointer, + + FfiConverterTypeActorId.lower(`actor`), + $0 + ) + } } - public func `fork`() -> Doc { - return try! FfiConverterTypeDoc.lift( - try! - rustCall() { - - uniffi_automerge_fn_method_doc_fork(self.pointer, $0 - ) -} + public func fork() -> Doc { + try! FfiConverterTypeDoc.lift( + try! + rustCall { + uniffi_automerge_fn_method_doc_fork( + self.pointer, + $0 + ) + } ) } - public func `forkAt`(`heads`: [ChangeHash]) throws -> Doc { - return try FfiConverterTypeDoc.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_fork_at(self.pointer, - FfiConverterSequenceTypeChangeHash.lower(`heads`),$0 - ) -} + public func forkAt(heads: [ChangeHash]) throws -> Doc { + try FfiConverterTypeDoc.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_fork_at( + self.pointer, + + FfiConverterSequenceTypeChangeHash.lower(heads), + $0 + ) + } ) } - public func `putInMap`(`obj`: ObjId, `key`: String, `value`: ScalarValue) throws { - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_put_in_map(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterString.lower(`key`), - FfiConverterTypeScalarValue.lower(`value`),$0 - ) -} + public func putInMap(obj: ObjId, key: String, value: ScalarValue) throws { + try + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_put_in_map( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterString.lower(key), + FfiConverterTypeScalarValue.lower(value), + $0 + ) + } } - public func `putObjectInMap`(`obj`: ObjId, `key`: String, `objType`: ObjType) throws -> ObjId { - return try FfiConverterTypeObjId.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_put_object_in_map(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterString.lower(`key`), - FfiConverterTypeObjType.lower(`objType`),$0 - ) -} + public func putObjectInMap(obj: ObjId, key: String, objType: ObjType) throws -> ObjId { + try FfiConverterTypeObjId.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_put_object_in_map( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterString.lower(key), + FfiConverterTypeObjType.lower(objType), + $0 + ) + } ) } - public func `putInList`(`obj`: ObjId, `index`: UInt64, `value`: ScalarValue) throws { - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_put_in_list(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterUInt64.lower(`index`), - FfiConverterTypeScalarValue.lower(`value`),$0 - ) -} + public func putInList(obj: ObjId, index: UInt64, value: ScalarValue) throws { + try + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_put_in_list( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterUInt64.lower(index), + FfiConverterTypeScalarValue.lower(value), + $0 + ) + } } - public func `putObjectInList`(`obj`: ObjId, `index`: UInt64, `objType`: ObjType) throws -> ObjId { - return try FfiConverterTypeObjId.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_put_object_in_list(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterUInt64.lower(`index`), - FfiConverterTypeObjType.lower(`objType`),$0 - ) -} + public func putObjectInList(obj: ObjId, index: UInt64, objType: ObjType) throws -> ObjId { + try FfiConverterTypeObjId.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_put_object_in_list( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterUInt64.lower(index), + FfiConverterTypeObjType.lower(objType), + $0 + ) + } ) } - public func `insertInList`(`obj`: ObjId, `index`: UInt64, `value`: ScalarValue) throws { - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_insert_in_list(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterUInt64.lower(`index`), - FfiConverterTypeScalarValue.lower(`value`),$0 - ) -} + public func insertInList(obj: ObjId, index: UInt64, value: ScalarValue) throws { + try + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_insert_in_list( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterUInt64.lower(index), + FfiConverterTypeScalarValue.lower(value), + $0 + ) + } } - public func `insertObjectInList`(`obj`: ObjId, `index`: UInt64, `objType`: ObjType) throws -> ObjId { - return try FfiConverterTypeObjId.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_insert_object_in_list(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterUInt64.lower(`index`), - FfiConverterTypeObjType.lower(`objType`),$0 - ) -} + public func insertObjectInList(obj: ObjId, index: UInt64, objType: ObjType) throws -> ObjId { + try FfiConverterTypeObjId.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_insert_object_in_list( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterUInt64.lower(index), + FfiConverterTypeObjType.lower(objType), + $0 + ) + } ) } - public func `spliceText`(`obj`: ObjId, `start`: UInt64, `delete`: Int64, `chars`: String) throws { - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_splice_text(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterUInt64.lower(`start`), - FfiConverterInt64.lower(`delete`), - FfiConverterString.lower(`chars`),$0 - ) -} + public func spliceText(obj: ObjId, start: UInt64, delete: Int64, chars: String) throws { + try + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_splice_text( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterUInt64.lower(start), + FfiConverterInt64.lower(delete), + FfiConverterString.lower(chars), + $0 + ) + } } - public func `splice`(`obj`: ObjId, `start`: UInt64, `delete`: Int64, `values`: [ScalarValue]) throws { - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_splice(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterUInt64.lower(`start`), - FfiConverterInt64.lower(`delete`), - FfiConverterSequenceTypeScalarValue.lower(`values`),$0 - ) -} + public func splice(obj: ObjId, start: UInt64, delete: Int64, values: [ScalarValue]) throws { + try + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_splice( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterUInt64.lower(start), + FfiConverterInt64.lower(delete), + FfiConverterSequenceTypeScalarValue.lower(values), + $0 + ) + } } - public func `mark`(`obj`: ObjId, `start`: UInt64, `end`: UInt64, `expand`: ExpandMark, `name`: String, `value`: ScalarValue) throws { - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_mark(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterUInt64.lower(`start`), - FfiConverterUInt64.lower(`end`), - FfiConverterTypeExpandMark.lower(`expand`), - FfiConverterString.lower(`name`), - FfiConverterTypeScalarValue.lower(`value`),$0 - ) -} + public func mark( + obj: ObjId, + start: UInt64, + end: UInt64, + expand: ExpandMark, + name: String, + value: ScalarValue + ) throws { + try + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_mark( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterUInt64.lower(start), + FfiConverterUInt64.lower(end), + FfiConverterTypeExpandMark.lower(expand), + FfiConverterString.lower(name), + FfiConverterTypeScalarValue.lower(value), + $0 + ) + } } - public func `marks`(`obj`: ObjId) throws -> [Mark] { - return try FfiConverterSequenceTypeMark.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_marks(self.pointer, - FfiConverterTypeObjId.lower(`obj`),$0 - ) -} + public func marks(obj: ObjId) throws -> [Mark] { + try FfiConverterSequenceTypeMark.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_marks( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + $0 + ) + } ) } - public func `marksAt`(`obj`: ObjId, `heads`: [ChangeHash]) throws -> [Mark] { - return try FfiConverterSequenceTypeMark.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_marks_at(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterSequenceTypeChangeHash.lower(`heads`),$0 - ) -} + public func marksAt(obj: ObjId, heads: [ChangeHash]) throws -> [Mark] { + try FfiConverterSequenceTypeMark.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_marks_at( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterSequenceTypeChangeHash.lower(heads), + $0 + ) + } ) } - public func `deleteInMap`(`obj`: ObjId, `key`: String) throws { - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_delete_in_map(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterString.lower(`key`),$0 - ) -} + public func deleteInMap(obj: ObjId, key: String) throws { + try + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_delete_in_map( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterString.lower(key), + $0 + ) + } } - public func `deleteInList`(`obj`: ObjId, `index`: UInt64) throws { - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_delete_in_list(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterUInt64.lower(`index`),$0 - ) -} + public func deleteInList(obj: ObjId, index: UInt64) throws { + try + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_delete_in_list( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterUInt64.lower(index), + $0 + ) + } } - public func `incrementInMap`(`obj`: ObjId, `key`: String, `by`: Int64) throws { - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_increment_in_map(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterString.lower(`key`), - FfiConverterInt64.lower(`by`),$0 - ) -} + public func incrementInMap(obj: ObjId, key: String, by: Int64) throws { + try + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_increment_in_map( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterString.lower(key), + FfiConverterInt64.lower(by), + $0 + ) + } } - public func `incrementInList`(`obj`: ObjId, `index`: UInt64, `by`: Int64) throws { - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_increment_in_list(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterUInt64.lower(`index`), - FfiConverterInt64.lower(`by`),$0 - ) -} + public func incrementInList(obj: ObjId, index: UInt64, by: Int64) throws { + try + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_increment_in_list( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterUInt64.lower(index), + FfiConverterInt64.lower(by), + $0 + ) + } } - public func `getInMap`(`obj`: ObjId, `key`: String) throws -> Value? { - return try FfiConverterOptionTypeValue.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_get_in_map(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterString.lower(`key`),$0 - ) -} + public func getInMap(obj: ObjId, key: String) throws -> Value? { + try FfiConverterOptionTypeValue.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_get_in_map( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterString.lower(key), + $0 + ) + } ) } - public func `getInList`(`obj`: ObjId, `index`: UInt64) throws -> Value? { - return try FfiConverterOptionTypeValue.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_get_in_list(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterUInt64.lower(`index`),$0 - ) -} + public func getInList(obj: ObjId, index: UInt64) throws -> Value? { + try FfiConverterOptionTypeValue.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_get_in_list( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterUInt64.lower(index), + $0 + ) + } ) } - public func `getAtInMap`(`obj`: ObjId, `key`: String, `heads`: [ChangeHash]) throws -> Value? { - return try FfiConverterOptionTypeValue.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_get_at_in_map(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterString.lower(`key`), - FfiConverterSequenceTypeChangeHash.lower(`heads`),$0 - ) -} + public func getAtInMap(obj: ObjId, key: String, heads: [ChangeHash]) throws -> Value? { + try FfiConverterOptionTypeValue.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_get_at_in_map( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterString.lower(key), + FfiConverterSequenceTypeChangeHash.lower(heads), + $0 + ) + } ) } - public func `getAtInList`(`obj`: ObjId, `index`: UInt64, `heads`: [ChangeHash]) throws -> Value? { - return try FfiConverterOptionTypeValue.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_get_at_in_list(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterUInt64.lower(`index`), - FfiConverterSequenceTypeChangeHash.lower(`heads`),$0 - ) -} + public func getAtInList(obj: ObjId, index: UInt64, heads: [ChangeHash]) throws -> Value? { + try FfiConverterOptionTypeValue.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_get_at_in_list( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterUInt64.lower(index), + FfiConverterSequenceTypeChangeHash.lower(heads), + $0 + ) + } ) } - public func `getAllInMap`(`obj`: ObjId, `key`: String) throws -> [Value] { - return try FfiConverterSequenceTypeValue.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_get_all_in_map(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterString.lower(`key`),$0 - ) -} + public func getAllInMap(obj: ObjId, key: String) throws -> [Value] { + try FfiConverterSequenceTypeValue.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_get_all_in_map( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterString.lower(key), + $0 + ) + } ) } - public func `getAllInList`(`obj`: ObjId, `index`: UInt64) throws -> [Value] { - return try FfiConverterSequenceTypeValue.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_get_all_in_list(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterUInt64.lower(`index`),$0 - ) -} + public func getAllInList(obj: ObjId, index: UInt64) throws -> [Value] { + try FfiConverterSequenceTypeValue.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_get_all_in_list( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterUInt64.lower(index), + $0 + ) + } ) } - public func `getAllAtInMap`(`obj`: ObjId, `key`: String, `heads`: [ChangeHash]) throws -> [Value] { - return try FfiConverterSequenceTypeValue.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_get_all_at_in_map(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterString.lower(`key`), - FfiConverterSequenceTypeChangeHash.lower(`heads`),$0 - ) -} + public func getAllAtInMap(obj: ObjId, key: String, heads: [ChangeHash]) throws -> [Value] { + try FfiConverterSequenceTypeValue.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_get_all_at_in_map( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterString.lower(key), + FfiConverterSequenceTypeChangeHash.lower(heads), + $0 + ) + } ) } - public func `getAllAtInList`(`obj`: ObjId, `index`: UInt64, `heads`: [ChangeHash]) throws -> [Value] { - return try FfiConverterSequenceTypeValue.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_get_all_at_in_list(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterUInt64.lower(`index`), - FfiConverterSequenceTypeChangeHash.lower(`heads`),$0 - ) -} + public func getAllAtInList(obj: ObjId, index: UInt64, heads: [ChangeHash]) throws -> [Value] { + try FfiConverterSequenceTypeValue.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_get_all_at_in_list( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterUInt64.lower(index), + FfiConverterSequenceTypeChangeHash.lower(heads), + $0 + ) + } ) } - public func `text`(`obj`: ObjId) throws -> String { - return try FfiConverterString.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_text(self.pointer, - FfiConverterTypeObjId.lower(`obj`),$0 - ) -} + public func text(obj: ObjId) throws -> String { + try FfiConverterString.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_text( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + $0 + ) + } ) } - public func `textAt`(`obj`: ObjId, `heads`: [ChangeHash]) throws -> String { - return try FfiConverterString.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_text_at(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterSequenceTypeChangeHash.lower(`heads`),$0 - ) -} + public func textAt(obj: ObjId, heads: [ChangeHash]) throws -> String { + try FfiConverterString.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_text_at( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterSequenceTypeChangeHash.lower(heads), + $0 + ) + } ) } - public func `mapKeys`(`obj`: ObjId) -> [String] { - return try! FfiConverterSequenceString.lift( - try! - rustCall() { - - uniffi_automerge_fn_method_doc_map_keys(self.pointer, - FfiConverterTypeObjId.lower(`obj`),$0 - ) -} + public func mapKeys(obj: ObjId) -> [String] { + try! FfiConverterSequenceString.lift( + try! + rustCall { + uniffi_automerge_fn_method_doc_map_keys( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + $0 + ) + } ) } - public func `mapKeysAt`(`obj`: ObjId, `heads`: [ChangeHash]) -> [String] { - return try! FfiConverterSequenceString.lift( - try! - rustCall() { - - uniffi_automerge_fn_method_doc_map_keys_at(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterSequenceTypeChangeHash.lower(`heads`),$0 - ) -} + public func mapKeysAt(obj: ObjId, heads: [ChangeHash]) -> [String] { + try! FfiConverterSequenceString.lift( + try! + rustCall { + uniffi_automerge_fn_method_doc_map_keys_at( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterSequenceTypeChangeHash.lower(heads), + $0 + ) + } ) } - public func `mapEntries`(`obj`: ObjId) throws -> [KeyValue] { - return try FfiConverterSequenceTypeKeyValue.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_map_entries(self.pointer, - FfiConverterTypeObjId.lower(`obj`),$0 - ) -} + public func mapEntries(obj: ObjId) throws -> [KeyValue] { + try FfiConverterSequenceTypeKeyValue.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_map_entries( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + $0 + ) + } ) } - public func `mapEntriesAt`(`obj`: ObjId, `heads`: [ChangeHash]) throws -> [KeyValue] { - return try FfiConverterSequenceTypeKeyValue.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_map_entries_at(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterSequenceTypeChangeHash.lower(`heads`),$0 - ) -} + public func mapEntriesAt(obj: ObjId, heads: [ChangeHash]) throws -> [KeyValue] { + try FfiConverterSequenceTypeKeyValue.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_map_entries_at( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterSequenceTypeChangeHash.lower(heads), + $0 + ) + } ) } - public func `values`(`obj`: ObjId) throws -> [Value] { - return try FfiConverterSequenceTypeValue.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_values(self.pointer, - FfiConverterTypeObjId.lower(`obj`),$0 - ) -} + public func values(obj: ObjId) throws -> [Value] { + try FfiConverterSequenceTypeValue.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_values( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + $0 + ) + } ) } - public func `valuesAt`(`obj`: ObjId, `heads`: [ChangeHash]) throws -> [Value] { - return try FfiConverterSequenceTypeValue.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_values_at(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterSequenceTypeChangeHash.lower(`heads`),$0 - ) -} + public func valuesAt(obj: ObjId, heads: [ChangeHash]) throws -> [Value] { + try FfiConverterSequenceTypeValue.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_values_at( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterSequenceTypeChangeHash.lower(heads), + $0 + ) + } ) } - public func `length`(`obj`: ObjId) -> UInt64 { - return try! FfiConverterUInt64.lift( - try! - rustCall() { - - uniffi_automerge_fn_method_doc_length(self.pointer, - FfiConverterTypeObjId.lower(`obj`),$0 - ) -} + public func length(obj: ObjId) -> UInt64 { + try! FfiConverterUInt64.lift( + try! + rustCall { + uniffi_automerge_fn_method_doc_length( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + $0 + ) + } ) } - public func `lengthAt`(`obj`: ObjId, `heads`: [ChangeHash]) -> UInt64 { - return try! FfiConverterUInt64.lift( - try! - rustCall() { - - uniffi_automerge_fn_method_doc_length_at(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterSequenceTypeChangeHash.lower(`heads`),$0 - ) -} + public func lengthAt(obj: ObjId, heads: [ChangeHash]) -> UInt64 { + try! FfiConverterUInt64.lift( + try! + rustCall { + uniffi_automerge_fn_method_doc_length_at( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterSequenceTypeChangeHash.lower(heads), + $0 + ) + } ) } - public func `objectType`(`obj`: ObjId) -> ObjType { - return try! FfiConverterTypeObjType.lift( - try! - rustCall() { - - uniffi_automerge_fn_method_doc_object_type(self.pointer, - FfiConverterTypeObjId.lower(`obj`),$0 - ) -} + public func objectType(obj: ObjId) -> ObjType { + try! FfiConverterTypeObjType.lift( + try! + rustCall { + uniffi_automerge_fn_method_doc_object_type( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + $0 + ) + } ) } - public func `path`(`obj`: ObjId) throws -> [PathElement] { - return try FfiConverterSequenceTypePathElement.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_path(self.pointer, - FfiConverterTypeObjId.lower(`obj`),$0 - ) -} + public func path(obj: ObjId) throws -> [PathElement] { + try FfiConverterSequenceTypePathElement.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_path( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + $0 + ) + } ) } - public func `heads`() -> [ChangeHash] { - return try! FfiConverterSequenceTypeChangeHash.lift( - try! - rustCall() { - - uniffi_automerge_fn_method_doc_heads(self.pointer, $0 - ) -} + public func heads() -> [ChangeHash] { + try! FfiConverterSequenceTypeChangeHash.lift( + try! + rustCall { + uniffi_automerge_fn_method_doc_heads( + self.pointer, + $0 + ) + } ) } - public func `changes`() -> [ChangeHash] { - return try! FfiConverterSequenceTypeChangeHash.lift( - try! - rustCall() { - - uniffi_automerge_fn_method_doc_changes(self.pointer, $0 - ) -} + public func changes() -> [ChangeHash] { + try! FfiConverterSequenceTypeChangeHash.lift( + try! + rustCall { + uniffi_automerge_fn_method_doc_changes( + self.pointer, + $0 + ) + } ) } - public func `save`() -> [UInt8] { - return try! FfiConverterSequenceUInt8.lift( - try! - rustCall() { - - uniffi_automerge_fn_method_doc_save(self.pointer, $0 - ) -} + public func save() -> [UInt8] { + try! FfiConverterSequenceUInt8.lift( + try! + rustCall { + uniffi_automerge_fn_method_doc_save( + self.pointer, + $0 + ) + } ) } - public func `merge`(`other`: Doc) throws { - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_merge(self.pointer, - FfiConverterTypeDoc.lower(`other`),$0 - ) -} + public func merge(other: Doc) throws { + try + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_merge( + self.pointer, + + FfiConverterTypeDoc.lower(other), + $0 + ) + } } - public func `mergeWithPatches`(`other`: Doc) throws -> [Patch] { - return try FfiConverterSequenceTypePatch.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_merge_with_patches(self.pointer, - FfiConverterTypeDoc.lower(`other`),$0 - ) -} + public func mergeWithPatches(other: Doc) throws -> [Patch] { + try FfiConverterSequenceTypePatch.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_merge_with_patches( + self.pointer, + + FfiConverterTypeDoc.lower(other), + $0 + ) + } ) } - public func `generateSyncMessage`(`state`: SyncState) -> [UInt8]? { - return try! FfiConverterOptionSequenceUInt8.lift( - try! - rustCall() { - - uniffi_automerge_fn_method_doc_generate_sync_message(self.pointer, - FfiConverterTypeSyncState.lower(`state`),$0 - ) -} + public func generateSyncMessage(state: SyncState) -> [UInt8]? { + try! FfiConverterOptionSequenceUInt8.lift( + try! + rustCall { + uniffi_automerge_fn_method_doc_generate_sync_message( + self.pointer, + + FfiConverterTypeSyncState.lower(state), + $0 + ) + } ) } - public func `receiveSyncMessage`(`state`: SyncState, `msg`: [UInt8]) throws { - try - rustCallWithError(FfiConverterTypeReceiveSyncError.lift) { - uniffi_automerge_fn_method_doc_receive_sync_message(self.pointer, - FfiConverterTypeSyncState.lower(`state`), - FfiConverterSequenceUInt8.lower(`msg`),$0 - ) -} + public func receiveSyncMessage(state: SyncState, msg: [UInt8]) throws { + try + rustCallWithError(FfiConverterTypeReceiveSyncError.lift) { + uniffi_automerge_fn_method_doc_receive_sync_message( + self.pointer, + + FfiConverterTypeSyncState.lower(state), + FfiConverterSequenceUInt8.lower(msg), + $0 + ) + } } - public func `receiveSyncMessageWithPatches`(`state`: SyncState, `msg`: [UInt8]) throws -> [Patch] { - return try FfiConverterSequenceTypePatch.lift( - try - rustCallWithError(FfiConverterTypeReceiveSyncError.lift) { - uniffi_automerge_fn_method_doc_receive_sync_message_with_patches(self.pointer, - FfiConverterTypeSyncState.lower(`state`), - FfiConverterSequenceUInt8.lower(`msg`),$0 - ) -} + public func receiveSyncMessageWithPatches(state: SyncState, msg: [UInt8]) throws -> [Patch] { + try FfiConverterSequenceTypePatch.lift( + rustCallWithError(FfiConverterTypeReceiveSyncError.lift) { + uniffi_automerge_fn_method_doc_receive_sync_message_with_patches( + self.pointer, + + FfiConverterTypeSyncState.lower(state), + FfiConverterSequenceUInt8.lower(msg), + $0 + ) + } ) } - public func `encodeNewChanges`() -> [UInt8] { - return try! FfiConverterSequenceUInt8.lift( - try! - rustCall() { - - uniffi_automerge_fn_method_doc_encode_new_changes(self.pointer, $0 - ) -} + public func encodeNewChanges() -> [UInt8] { + try! FfiConverterSequenceUInt8.lift( + try! + rustCall { + uniffi_automerge_fn_method_doc_encode_new_changes( + self.pointer, + $0 + ) + } ) } - public func `encodeChangesSince`(`heads`: [ChangeHash]) throws -> [UInt8] { - return try FfiConverterSequenceUInt8.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_encode_changes_since(self.pointer, - FfiConverterSequenceTypeChangeHash.lower(`heads`),$0 - ) -} + public func encodeChangesSince(heads: [ChangeHash]) throws -> [UInt8] { + try FfiConverterSequenceUInt8.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_encode_changes_since( + self.pointer, + + FfiConverterSequenceTypeChangeHash.lower(heads), + $0 + ) + } ) } - public func `applyEncodedChanges`(`changes`: [UInt8]) throws { - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_apply_encoded_changes(self.pointer, - FfiConverterSequenceUInt8.lower(`changes`),$0 - ) -} + public func applyEncodedChanges(changes: [UInt8]) throws { + try + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_apply_encoded_changes( + self.pointer, + + FfiConverterSequenceUInt8.lower(changes), + $0 + ) + } } - public func `applyEncodedChangesWithPatches`(`changes`: [UInt8]) throws -> [Patch] { - return try FfiConverterSequenceTypePatch.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_apply_encoded_changes_with_patches(self.pointer, - FfiConverterSequenceUInt8.lower(`changes`),$0 - ) -} + public func applyEncodedChangesWithPatches(changes: [UInt8]) throws -> [Patch] { + try FfiConverterSequenceTypePatch.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_apply_encoded_changes_with_patches( + self.pointer, + + FfiConverterSequenceUInt8.lower(changes), + $0 + ) + } ) } - public func `cursor`(`obj`: ObjId, `position`: UInt64) throws -> Cursor { - return try FfiConverterTypeCursor.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_cursor(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterUInt64.lower(`position`),$0 - ) -} + public func cursor(obj: ObjId, position: UInt64) throws -> Cursor { + try FfiConverterTypeCursor.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_cursor( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterUInt64.lower(position), + $0 + ) + } ) } - public func `cursorAt`(`obj`: ObjId, `position`: UInt64, `heads`: [ChangeHash]) throws -> Cursor { - return try FfiConverterTypeCursor.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_cursor_at(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterUInt64.lower(`position`), - FfiConverterSequenceTypeChangeHash.lower(`heads`),$0 - ) -} + public func cursorAt(obj: ObjId, position: UInt64, heads: [ChangeHash]) throws -> Cursor { + try FfiConverterTypeCursor.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_cursor_at( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterUInt64.lower(position), + FfiConverterSequenceTypeChangeHash.lower(heads), + $0 + ) + } ) } - public func `cursorPosition`(`obj`: ObjId, `cursor`: Cursor) throws -> UInt64 { - return try FfiConverterUInt64.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_cursor_position(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterTypeCursor.lower(`cursor`),$0 - ) -} + public func cursorPosition(obj: ObjId, cursor: Cursor) throws -> UInt64 { + try FfiConverterUInt64.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_cursor_position( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterTypeCursor.lower(cursor), + $0 + ) + } ) } - public func `cursorPositionAt`(`obj`: ObjId, `cursor`: Cursor, `heads`: [ChangeHash]) throws -> UInt64 { - return try FfiConverterUInt64.lift( - try - rustCallWithError(FfiConverterTypeDocError.lift) { - uniffi_automerge_fn_method_doc_cursor_position_at(self.pointer, - FfiConverterTypeObjId.lower(`obj`), - FfiConverterTypeCursor.lower(`cursor`), - FfiConverterSequenceTypeChangeHash.lower(`heads`),$0 - ) -} + public func cursorPositionAt(obj: ObjId, cursor: Cursor, heads: [ChangeHash]) throws -> UInt64 { + try FfiConverterUInt64.lift( + rustCallWithError(FfiConverterTypeDocError.lift) { + uniffi_automerge_fn_method_doc_cursor_position_at( + self.pointer, + + FfiConverterTypeObjId.lower(obj), + FfiConverterTypeCursor.lower(cursor), + FfiConverterSequenceTypeChangeHash.lower(heads), + $0 + ) + } ) } } @@ -1155,7 +1272,7 @@ public struct FfiConverterTypeDoc: FfiConverter { // The Rust code won't compile if a pointer won't fit in a UInt64. // We have to go via `UInt` because that's the thing that's the size of a pointer. let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) - if (ptr == nil) { + if ptr == nil { throw UniffiInternalError.unexpectedNullPointer } return try lift(ptr!) @@ -1168,29 +1285,26 @@ public struct FfiConverterTypeDoc: FfiConverter { } public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> Doc { - return Doc(unsafeFromRawPointer: pointer) + Doc(unsafeFromRawPointer: pointer) } public static func lower(_ value: Doc) -> UnsafeMutableRawPointer { - return value.pointer + value.pointer } } - public func FfiConverterTypeDoc_lift(_ pointer: UnsafeMutableRawPointer) throws -> Doc { - return try FfiConverterTypeDoc.lift(pointer) + try FfiConverterTypeDoc.lift(pointer) } public func FfiConverterTypeDoc_lower(_ value: Doc) -> UnsafeMutableRawPointer { - return FfiConverterTypeDoc.lower(value) + FfiConverterTypeDoc.lower(value) } - public protocol SyncStateProtocol { - func `encode`() -> [UInt8] - func `reset`() - func `theirHeads`() -> [ChangeHash]? - + func encode() -> [UInt8] + func reset() + func theirHeads() -> [ChangeHash]? } public class SyncState: SyncStateProtocol { @@ -1202,58 +1316,56 @@ public class SyncState: SyncStateProtocol { required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } - public convenience init() { - self.init(unsafeFromRawPointer: try! rustCall() { - uniffi_automerge_fn_constructor_syncstate_new($0) -}) + + public convenience init() { + self.init(unsafeFromRawPointer: try! rustCall { + uniffi_automerge_fn_constructor_syncstate_new($0) + }) } deinit { try! rustCall { uniffi_automerge_fn_free_syncstate(pointer, $0) } } - - - public static func `decode`(`bytes`: [UInt8]) throws -> SyncState { - return SyncState(unsafeFromRawPointer: try rustCallWithError(FfiConverterTypeDecodeSyncStateError.lift) { - uniffi_automerge_fn_constructor_syncstate_decode( - FfiConverterSequenceUInt8.lower(`bytes`),$0) -}) + public static func decode(bytes: [UInt8]) throws -> SyncState { + try SyncState(unsafeFromRawPointer: rustCallWithError(FfiConverterTypeDecodeSyncStateError.lift) { + uniffi_automerge_fn_constructor_syncstate_decode( + FfiConverterSequenceUInt8.lower(bytes), $0 + ) + }) } - - - - - - public func `encode`() -> [UInt8] { - return try! FfiConverterSequenceUInt8.lift( - try! - rustCall() { - - uniffi_automerge_fn_method_syncstate_encode(self.pointer, $0 - ) -} + public func encode() -> [UInt8] { + try! FfiConverterSequenceUInt8.lift( + try! + rustCall { + uniffi_automerge_fn_method_syncstate_encode( + self.pointer, + $0 + ) + } ) } - public func `reset`() { - try! - rustCall() { - - uniffi_automerge_fn_method_syncstate_reset(self.pointer, $0 - ) -} + public func reset() { + try! + rustCall { + uniffi_automerge_fn_method_syncstate_reset( + self.pointer, + $0 + ) + } } - public func `theirHeads`() -> [ChangeHash]? { - return try! FfiConverterOptionSequenceTypeChangeHash.lift( - try! - rustCall() { - - uniffi_automerge_fn_method_syncstate_their_heads(self.pointer, $0 - ) -} + public func theirHeads() -> [ChangeHash]? { + try! FfiConverterOptionSequenceTypeChangeHash.lift( + try! + rustCall { + uniffi_automerge_fn_method_syncstate_their_heads( + self.pointer, + $0 + ) + } ) } } @@ -1267,7 +1379,7 @@ public struct FfiConverterTypeSyncState: FfiConverter { // The Rust code won't compile if a pointer won't fit in a UInt64. // We have to go via `UInt` because that's the thing that's the size of a pointer. let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) - if (ptr == nil) { + if ptr == nil { throw UniffiInternalError.unexpectedNullPointer } return try lift(ptr!) @@ -1280,287 +1392,260 @@ public struct FfiConverterTypeSyncState: FfiConverter { } public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> SyncState { - return SyncState(unsafeFromRawPointer: pointer) + SyncState(unsafeFromRawPointer: pointer) } public static func lower(_ value: SyncState) -> UnsafeMutableRawPointer { - return value.pointer + value.pointer } } - public func FfiConverterTypeSyncState_lift(_ pointer: UnsafeMutableRawPointer) throws -> SyncState { - return try FfiConverterTypeSyncState.lift(pointer) + try FfiConverterTypeSyncState.lift(pointer) } public func FfiConverterTypeSyncState_lower(_ value: SyncState) -> UnsafeMutableRawPointer { - return FfiConverterTypeSyncState.lower(value) + FfiConverterTypeSyncState.lower(value) } - public struct KeyValue { - public var `key`: String - public var `value`: Value + public var key: String + public var value: Value // Default memberwise initializers are never public by default, so we // declare one manually. - public init(`key`: String, `value`: Value) { - self.`key` = `key` - self.`value` = `value` + public init(key: String, value: Value) { + self.key = key + self.value = value } } - extension KeyValue: Equatable, Hashable { - public static func ==(lhs: KeyValue, rhs: KeyValue) -> Bool { - if lhs.`key` != rhs.`key` { + public static func == (lhs: KeyValue, rhs: KeyValue) -> Bool { + if lhs.key != rhs.key { return false } - if lhs.`value` != rhs.`value` { + if lhs.value != rhs.value { return false } return true } public func hash(into hasher: inout Hasher) { - hasher.combine(`key`) - hasher.combine(`value`) + hasher.combine(key) + hasher.combine(value) } } - public struct FfiConverterTypeKeyValue: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> KeyValue { - return try KeyValue( - `key`: FfiConverterString.read(from: &buf), - `value`: FfiConverterTypeValue.read(from: &buf) + try KeyValue( + key: FfiConverterString.read(from: &buf), + value: FfiConverterTypeValue.read(from: &buf) ) } public static func write(_ value: KeyValue, into buf: inout [UInt8]) { - FfiConverterString.write(value.`key`, into: &buf) - FfiConverterTypeValue.write(value.`value`, into: &buf) + FfiConverterString.write(value.key, into: &buf) + FfiConverterTypeValue.write(value.value, into: &buf) } } - public func FfiConverterTypeKeyValue_lift(_ buf: RustBuffer) throws -> KeyValue { - return try FfiConverterTypeKeyValue.lift(buf) + try FfiConverterTypeKeyValue.lift(buf) } public func FfiConverterTypeKeyValue_lower(_ value: KeyValue) -> RustBuffer { - return FfiConverterTypeKeyValue.lower(value) + FfiConverterTypeKeyValue.lower(value) } - public struct Mark { - public var `start`: UInt64 - public var `end`: UInt64 - public var `name`: String - public var `value`: Value + public var start: UInt64 + public var end: UInt64 + public var name: String + public var value: Value // Default memberwise initializers are never public by default, so we // declare one manually. - public init(`start`: UInt64, `end`: UInt64, `name`: String, `value`: Value) { - self.`start` = `start` - self.`end` = `end` - self.`name` = `name` - self.`value` = `value` + public init(start: UInt64, end: UInt64, name: String, value: Value) { + self.start = start + self.end = end + self.name = name + self.value = value } } - extension Mark: Equatable, Hashable { - public static func ==(lhs: Mark, rhs: Mark) -> Bool { - if lhs.`start` != rhs.`start` { + public static func == (lhs: Mark, rhs: Mark) -> Bool { + if lhs.start != rhs.start { return false } - if lhs.`end` != rhs.`end` { + if lhs.end != rhs.end { return false } - if lhs.`name` != rhs.`name` { + if lhs.name != rhs.name { return false } - if lhs.`value` != rhs.`value` { + if lhs.value != rhs.value { return false } return true } public func hash(into hasher: inout Hasher) { - hasher.combine(`start`) - hasher.combine(`end`) - hasher.combine(`name`) - hasher.combine(`value`) + hasher.combine(start) + hasher.combine(end) + hasher.combine(name) + hasher.combine(value) } } - public struct FfiConverterTypeMark: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Mark { - return try Mark( - `start`: FfiConverterUInt64.read(from: &buf), - `end`: FfiConverterUInt64.read(from: &buf), - `name`: FfiConverterString.read(from: &buf), - `value`: FfiConverterTypeValue.read(from: &buf) + try Mark( + start: FfiConverterUInt64.read(from: &buf), + end: FfiConverterUInt64.read(from: &buf), + name: FfiConverterString.read(from: &buf), + value: FfiConverterTypeValue.read(from: &buf) ) } public static func write(_ value: Mark, into buf: inout [UInt8]) { - FfiConverterUInt64.write(value.`start`, into: &buf) - FfiConverterUInt64.write(value.`end`, into: &buf) - FfiConverterString.write(value.`name`, into: &buf) - FfiConverterTypeValue.write(value.`value`, into: &buf) + FfiConverterUInt64.write(value.start, into: &buf) + FfiConverterUInt64.write(value.end, into: &buf) + FfiConverterString.write(value.name, into: &buf) + FfiConverterTypeValue.write(value.value, into: &buf) } } - public func FfiConverterTypeMark_lift(_ buf: RustBuffer) throws -> Mark { - return try FfiConverterTypeMark.lift(buf) + try FfiConverterTypeMark.lift(buf) } public func FfiConverterTypeMark_lower(_ value: Mark) -> RustBuffer { - return FfiConverterTypeMark.lower(value) + FfiConverterTypeMark.lower(value) } - public struct Patch { - public var `path`: [PathElement] - public var `action`: PatchAction + public var path: [PathElement] + public var action: PatchAction // Default memberwise initializers are never public by default, so we // declare one manually. - public init(`path`: [PathElement], `action`: PatchAction) { - self.`path` = `path` - self.`action` = `action` + public init(path: [PathElement], action: PatchAction) { + self.path = path + self.action = action } } - extension Patch: Equatable, Hashable { - public static func ==(lhs: Patch, rhs: Patch) -> Bool { - if lhs.`path` != rhs.`path` { + public static func == (lhs: Patch, rhs: Patch) -> Bool { + if lhs.path != rhs.path { return false } - if lhs.`action` != rhs.`action` { + if lhs.action != rhs.action { return false } return true } public func hash(into hasher: inout Hasher) { - hasher.combine(`path`) - hasher.combine(`action`) + hasher.combine(path) + hasher.combine(action) } } - public struct FfiConverterTypePatch: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Patch { - return try Patch( - `path`: FfiConverterSequenceTypePathElement.read(from: &buf), - `action`: FfiConverterTypePatchAction.read(from: &buf) + try Patch( + path: FfiConverterSequenceTypePathElement.read(from: &buf), + action: FfiConverterTypePatchAction.read(from: &buf) ) } public static func write(_ value: Patch, into buf: inout [UInt8]) { - FfiConverterSequenceTypePathElement.write(value.`path`, into: &buf) - FfiConverterTypePatchAction.write(value.`action`, into: &buf) + FfiConverterSequenceTypePathElement.write(value.path, into: &buf) + FfiConverterTypePatchAction.write(value.action, into: &buf) } } - public func FfiConverterTypePatch_lift(_ buf: RustBuffer) throws -> Patch { - return try FfiConverterTypePatch.lift(buf) + try FfiConverterTypePatch.lift(buf) } public func FfiConverterTypePatch_lower(_ value: Patch) -> RustBuffer { - return FfiConverterTypePatch.lower(value) + FfiConverterTypePatch.lower(value) } - public struct PathElement { - public var `prop`: Prop - public var `obj`: ObjId + public var prop: Prop + public var obj: ObjId // Default memberwise initializers are never public by default, so we // declare one manually. - public init(`prop`: Prop, `obj`: ObjId) { - self.`prop` = `prop` - self.`obj` = `obj` + public init(prop: Prop, obj: ObjId) { + self.prop = prop + self.obj = obj } } - extension PathElement: Equatable, Hashable { - public static func ==(lhs: PathElement, rhs: PathElement) -> Bool { - if lhs.`prop` != rhs.`prop` { + public static func == (lhs: PathElement, rhs: PathElement) -> Bool { + if lhs.prop != rhs.prop { return false } - if lhs.`obj` != rhs.`obj` { + if lhs.obj != rhs.obj { return false } return true } public func hash(into hasher: inout Hasher) { - hasher.combine(`prop`) - hasher.combine(`obj`) + hasher.combine(prop) + hasher.combine(obj) } } - public struct FfiConverterTypePathElement: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PathElement { - return try PathElement( - `prop`: FfiConverterTypeProp.read(from: &buf), - `obj`: FfiConverterTypeObjId.read(from: &buf) + try PathElement( + prop: FfiConverterTypeProp.read(from: &buf), + obj: FfiConverterTypeObjId.read(from: &buf) ) } public static func write(_ value: PathElement, into buf: inout [UInt8]) { - FfiConverterTypeProp.write(value.`prop`, into: &buf) - FfiConverterTypeObjId.write(value.`obj`, into: &buf) + FfiConverterTypeProp.write(value.prop, into: &buf) + FfiConverterTypeObjId.write(value.obj, into: &buf) } } - public func FfiConverterTypePathElement_lift(_ buf: RustBuffer) throws -> PathElement { - return try FfiConverterTypePathElement.lift(buf) + try FfiConverterTypePathElement.lift(buf) } public func FfiConverterTypePathElement_lower(_ value: PathElement) -> RustBuffer { - return FfiConverterTypePathElement.lower(value) + FfiConverterTypePathElement.lower(value) } public enum DecodeSyncStateError { - - - // Simple error enums only carry a message case Internal(message: String) - fileprivate static func uniffiErrorHandler(_ error: RustBuffer) throws -> Error { - return try FfiConverterTypeDecodeSyncStateError.lift(error) + try FfiConverterTypeDecodeSyncStateError.lift(error) } } - public struct FfiConverterTypeDecodeSyncStateError: FfiConverterRustBuffer { typealias SwiftType = DecodeSyncStateError public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> DecodeSyncStateError { let variant: Int32 = try readInt(&buf) switch variant { - - - - - case 1: return .Internal( - message: try FfiConverterString.read(from: &buf) - ) - + case 1: return try .Internal( + message: FfiConverterString.read(from: &buf) + ) default: throw UniffiInternalError.unexpectedEnumCase } @@ -1568,58 +1653,41 @@ public struct FfiConverterTypeDecodeSyncStateError: FfiConverterRustBuffer { public static func write(_ value: DecodeSyncStateError, into buf: inout [UInt8]) { switch value { - - - - case let .Internal(message): writeInt(&buf, Int32(1)) - - } } } - extension DecodeSyncStateError: Equatable, Hashable {} -extension DecodeSyncStateError: Error { } +extension DecodeSyncStateError: Error {} public enum DocError { - - - // Simple error enums only carry a message case WrongObjectType(message: String) - + // Simple error enums only carry a message case Internal(message: String) - fileprivate static func uniffiErrorHandler(_ error: RustBuffer) throws -> Error { - return try FfiConverterTypeDocError.lift(error) + try FfiConverterTypeDocError.lift(error) } } - public struct FfiConverterTypeDocError: FfiConverterRustBuffer { typealias SwiftType = DocError public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> DocError { let variant: Int32 = try readInt(&buf) switch variant { + case 1: return try .WrongObjectType( + message: FfiConverterString.read(from: &buf) + ) - - - - case 1: return .WrongObjectType( - message: try FfiConverterString.read(from: &buf) - ) - - case 2: return .Internal( - message: try FfiConverterString.read(from: &buf) - ) - + case 2: return try .Internal( + message: FfiConverterString.read(from: &buf) + ) default: throw UniffiInternalError.unexpectedEnumCase } @@ -1627,33 +1695,25 @@ public struct FfiConverterTypeDocError: FfiConverterRustBuffer { public static func write(_ value: DocError, into buf: inout [UInt8]) { switch value { - - - - case let .WrongObjectType(message): writeInt(&buf, Int32(1)) case let .Internal(message): writeInt(&buf, Int32(2)) - - } } } - extension DocError: Equatable, Hashable {} -extension DocError: Error { } +extension DocError: Error {} // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. public enum ExpandMark { - - case `before` - case `after` - case `none` - case `both` + case before + case after + case none + case both } public struct FfiConverterTypeExpandMark: FfiConverterRustBuffer { @@ -1662,84 +1722,63 @@ public struct FfiConverterTypeExpandMark: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ExpandMark { let variant: Int32 = try readInt(&buf) switch variant { - - case 1: return .`before` - - case 2: return .`after` - - case 3: return .`none` - - case 4: return .`both` - + case 1: return .before + + case 2: return .after + + case 3: return .none + + case 4: return .both + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: ExpandMark, into buf: inout [UInt8]) { switch value { - - - case .`before`: + case .before: writeInt(&buf, Int32(1)) - - - case .`after`: + + case .after: writeInt(&buf, Int32(2)) - - - case .`none`: + + case .none: writeInt(&buf, Int32(3)) - - - case .`both`: + + case .both: writeInt(&buf, Int32(4)) - } } } - public func FfiConverterTypeExpandMark_lift(_ buf: RustBuffer) throws -> ExpandMark { - return try FfiConverterTypeExpandMark.lift(buf) + try FfiConverterTypeExpandMark.lift(buf) } public func FfiConverterTypeExpandMark_lower(_ value: ExpandMark) -> RustBuffer { - return FfiConverterTypeExpandMark.lower(value) + FfiConverterTypeExpandMark.lower(value) } - extension ExpandMark: Equatable, Hashable {} - - public enum LoadError { - - - // Simple error enums only carry a message case Internal(message: String) - fileprivate static func uniffiErrorHandler(_ error: RustBuffer) throws -> Error { - return try FfiConverterTypeLoadError.lift(error) + try FfiConverterTypeLoadError.lift(error) } } - public struct FfiConverterTypeLoadError: FfiConverterRustBuffer { typealias SwiftType = LoadError public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LoadError { let variant: Int32 = try readInt(&buf) switch variant { - - - - - case 1: return .Internal( - message: try FfiConverterString.read(from: &buf) - ) - + case 1: return try .Internal( + message: FfiConverterString.read(from: &buf) + ) default: throw UniffiInternalError.unexpectedEnumCase } @@ -1747,30 +1786,22 @@ public struct FfiConverterTypeLoadError: FfiConverterRustBuffer { public static func write(_ value: LoadError, into buf: inout [UInt8]) { switch value { - - - - case let .Internal(message): writeInt(&buf, Int32(1)) - - } } } - extension LoadError: Equatable, Hashable {} -extension LoadError: Error { } +extension LoadError: Error {} // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. public enum ObjType { - - case `map` - case `list` - case `text` + case map + case list + case text } public struct FfiConverterTypeObjType: FfiConverterRustBuffer { @@ -1779,62 +1810,51 @@ public struct FfiConverterTypeObjType: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ObjType { let variant: Int32 = try readInt(&buf) switch variant { - - case 1: return .`map` - - case 2: return .`list` - - case 3: return .`text` - + case 1: return .map + + case 2: return .list + + case 3: return .text + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: ObjType, into buf: inout [UInt8]) { switch value { - - - case .`map`: + case .map: writeInt(&buf, Int32(1)) - - - case .`list`: + + case .list: writeInt(&buf, Int32(2)) - - - case .`text`: + + case .text: writeInt(&buf, Int32(3)) - } } } - public func FfiConverterTypeObjType_lift(_ buf: RustBuffer) throws -> ObjType { - return try FfiConverterTypeObjType.lift(buf) + try FfiConverterTypeObjType.lift(buf) } public func FfiConverterTypeObjType_lower(_ value: ObjType) -> RustBuffer { - return FfiConverterTypeObjType.lower(value) + FfiConverterTypeObjType.lower(value) } - extension ObjType: Equatable, Hashable {} - - // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. public enum PatchAction { - - case `put`(`obj`: ObjId, `prop`: Prop, `value`: Value) - case `insert`(`obj`: ObjId, `index`: UInt64, `values`: [Value], `marks`: [String: Value]) - case `spliceText`(`obj`: ObjId, `index`: UInt64, `value`: String, `marks`: [String: Value]) - case `increment`(`obj`: ObjId, `prop`: Prop, `value`: Int64) - case `conflict`(`obj`: ObjId, `prop`: Prop) - case `deleteMap`(`obj`: ObjId, `key`: String) - case `deleteSeq`(`obj`: ObjId, `index`: UInt64, `length`: UInt64) - case `marks`(`obj`: ObjId, `marks`: [Mark]) + case put(obj: ObjId, prop: Prop, value: Value) + case insert(obj: ObjId, index: UInt64, values: [Value], marks: [String: Value]) + case spliceText(obj: ObjId, index: UInt64, value: String, marks: [String: Value]) + case increment(obj: ObjId, prop: Prop, value: Int64) + case conflict(obj: ObjId, prop: Prop) + case deleteMap(obj: ObjId, key: String) + case deleteSeq(obj: ObjId, index: UInt64, length: UInt64) + case marks(obj: ObjId, marks: [Mark]) } public struct FfiConverterTypePatchAction: FfiConverterRustBuffer { @@ -1843,140 +1863,124 @@ public struct FfiConverterTypePatchAction: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> PatchAction { let variant: Int32 = try readInt(&buf) switch variant { - - case 1: return .`put`( - `obj`: try FfiConverterTypeObjId.read(from: &buf), - `prop`: try FfiConverterTypeProp.read(from: &buf), - `value`: try FfiConverterTypeValue.read(from: &buf) - ) - - case 2: return .`insert`( - `obj`: try FfiConverterTypeObjId.read(from: &buf), - `index`: try FfiConverterUInt64.read(from: &buf), - `values`: try FfiConverterSequenceTypeValue.read(from: &buf), - `marks`: try FfiConverterDictionaryStringTypeValue.read(from: &buf) - ) - - case 3: return .`spliceText`( - `obj`: try FfiConverterTypeObjId.read(from: &buf), - `index`: try FfiConverterUInt64.read(from: &buf), - `value`: try FfiConverterString.read(from: &buf), - `marks`: try FfiConverterDictionaryStringTypeValue.read(from: &buf) - ) - - case 4: return .`increment`( - `obj`: try FfiConverterTypeObjId.read(from: &buf), - `prop`: try FfiConverterTypeProp.read(from: &buf), - `value`: try FfiConverterInt64.read(from: &buf) - ) - - case 5: return .`conflict`( - `obj`: try FfiConverterTypeObjId.read(from: &buf), - `prop`: try FfiConverterTypeProp.read(from: &buf) - ) - - case 6: return .`deleteMap`( - `obj`: try FfiConverterTypeObjId.read(from: &buf), - `key`: try FfiConverterString.read(from: &buf) - ) - - case 7: return .`deleteSeq`( - `obj`: try FfiConverterTypeObjId.read(from: &buf), - `index`: try FfiConverterUInt64.read(from: &buf), - `length`: try FfiConverterUInt64.read(from: &buf) - ) - - case 8: return .`marks`( - `obj`: try FfiConverterTypeObjId.read(from: &buf), - `marks`: try FfiConverterSequenceTypeMark.read(from: &buf) - ) - + case 1: return try .put( + obj: FfiConverterTypeObjId.read(from: &buf), + prop: FfiConverterTypeProp.read(from: &buf), + value: FfiConverterTypeValue.read(from: &buf) + ) + + case 2: return try .insert( + obj: FfiConverterTypeObjId.read(from: &buf), + index: FfiConverterUInt64.read(from: &buf), + values: FfiConverterSequenceTypeValue.read(from: &buf), + marks: FfiConverterDictionaryStringTypeValue.read(from: &buf) + ) + + case 3: return try .spliceText( + obj: FfiConverterTypeObjId.read(from: &buf), + index: FfiConverterUInt64.read(from: &buf), + value: FfiConverterString.read(from: &buf), + marks: FfiConverterDictionaryStringTypeValue.read(from: &buf) + ) + + case 4: return try .increment( + obj: FfiConverterTypeObjId.read(from: &buf), + prop: FfiConverterTypeProp.read(from: &buf), + value: FfiConverterInt64.read(from: &buf) + ) + + case 5: return try .conflict( + obj: FfiConverterTypeObjId.read(from: &buf), + prop: FfiConverterTypeProp.read(from: &buf) + ) + + case 6: return try .deleteMap( + obj: FfiConverterTypeObjId.read(from: &buf), + key: FfiConverterString.read(from: &buf) + ) + + case 7: return try .deleteSeq( + obj: FfiConverterTypeObjId.read(from: &buf), + index: FfiConverterUInt64.read(from: &buf), + length: FfiConverterUInt64.read(from: &buf) + ) + + case 8: return try .marks( + obj: FfiConverterTypeObjId.read(from: &buf), + marks: FfiConverterSequenceTypeMark.read(from: &buf) + ) + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: PatchAction, into buf: inout [UInt8]) { switch value { - - - case let .`put`(`obj`,`prop`,`value`): + case let .put(obj, prop, value): writeInt(&buf, Int32(1)) - FfiConverterTypeObjId.write(`obj`, into: &buf) - FfiConverterTypeProp.write(`prop`, into: &buf) - FfiConverterTypeValue.write(`value`, into: &buf) - - - case let .`insert`(`obj`,`index`,`values`,`marks`): + FfiConverterTypeObjId.write(obj, into: &buf) + FfiConverterTypeProp.write(prop, into: &buf) + FfiConverterTypeValue.write(value, into: &buf) + + case let .insert(obj, index, values, marks): writeInt(&buf, Int32(2)) - FfiConverterTypeObjId.write(`obj`, into: &buf) - FfiConverterUInt64.write(`index`, into: &buf) - FfiConverterSequenceTypeValue.write(`values`, into: &buf) - FfiConverterDictionaryStringTypeValue.write(`marks`, into: &buf) - - - case let .`spliceText`(`obj`,`index`,`value`,`marks`): + FfiConverterTypeObjId.write(obj, into: &buf) + FfiConverterUInt64.write(index, into: &buf) + FfiConverterSequenceTypeValue.write(values, into: &buf) + FfiConverterDictionaryStringTypeValue.write(marks, into: &buf) + + case let .spliceText(obj, index, value, marks): writeInt(&buf, Int32(3)) - FfiConverterTypeObjId.write(`obj`, into: &buf) - FfiConverterUInt64.write(`index`, into: &buf) - FfiConverterString.write(`value`, into: &buf) - FfiConverterDictionaryStringTypeValue.write(`marks`, into: &buf) - - - case let .`increment`(`obj`,`prop`,`value`): + FfiConverterTypeObjId.write(obj, into: &buf) + FfiConverterUInt64.write(index, into: &buf) + FfiConverterString.write(value, into: &buf) + FfiConverterDictionaryStringTypeValue.write(marks, into: &buf) + + case let .increment(obj, prop, value): writeInt(&buf, Int32(4)) - FfiConverterTypeObjId.write(`obj`, into: &buf) - FfiConverterTypeProp.write(`prop`, into: &buf) - FfiConverterInt64.write(`value`, into: &buf) - - - case let .`conflict`(`obj`,`prop`): + FfiConverterTypeObjId.write(obj, into: &buf) + FfiConverterTypeProp.write(prop, into: &buf) + FfiConverterInt64.write(value, into: &buf) + + case let .conflict(obj, prop): writeInt(&buf, Int32(5)) - FfiConverterTypeObjId.write(`obj`, into: &buf) - FfiConverterTypeProp.write(`prop`, into: &buf) - - - case let .`deleteMap`(`obj`,`key`): + FfiConverterTypeObjId.write(obj, into: &buf) + FfiConverterTypeProp.write(prop, into: &buf) + + case let .deleteMap(obj, key): writeInt(&buf, Int32(6)) - FfiConverterTypeObjId.write(`obj`, into: &buf) - FfiConverterString.write(`key`, into: &buf) - - - case let .`deleteSeq`(`obj`,`index`,`length`): + FfiConverterTypeObjId.write(obj, into: &buf) + FfiConverterString.write(key, into: &buf) + + case let .deleteSeq(obj, index, length): writeInt(&buf, Int32(7)) - FfiConverterTypeObjId.write(`obj`, into: &buf) - FfiConverterUInt64.write(`index`, into: &buf) - FfiConverterUInt64.write(`length`, into: &buf) - - - case let .`marks`(`obj`,`marks`): + FfiConverterTypeObjId.write(obj, into: &buf) + FfiConverterUInt64.write(index, into: &buf) + FfiConverterUInt64.write(length, into: &buf) + + case let .marks(obj, marks): writeInt(&buf, Int32(8)) - FfiConverterTypeObjId.write(`obj`, into: &buf) - FfiConverterSequenceTypeMark.write(`marks`, into: &buf) - + FfiConverterTypeObjId.write(obj, into: &buf) + FfiConverterSequenceTypeMark.write(marks, into: &buf) } } } - public func FfiConverterTypePatchAction_lift(_ buf: RustBuffer) throws -> PatchAction { - return try FfiConverterTypePatchAction.lift(buf) + try FfiConverterTypePatchAction.lift(buf) } public func FfiConverterTypePatchAction_lower(_ value: PatchAction) -> RustBuffer { - return FfiConverterTypePatchAction.lower(value) + FfiConverterTypePatchAction.lower(value) } - extension PatchAction: Equatable, Hashable {} - - // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. public enum Prop { - - case `key`(`value`: String) - case `index`(`value`: UInt64) + case key(value: String) + case index(value: UInt64) } public struct FfiConverterTypeProp: FfiConverterRustBuffer { @@ -1985,85 +1989,66 @@ public struct FfiConverterTypeProp: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Prop { let variant: Int32 = try readInt(&buf) switch variant { - - case 1: return .`key`( - `value`: try FfiConverterString.read(from: &buf) - ) - - case 2: return .`index`( - `value`: try FfiConverterUInt64.read(from: &buf) - ) - + case 1: return try .key( + value: FfiConverterString.read(from: &buf) + ) + + case 2: return try .index( + value: FfiConverterUInt64.read(from: &buf) + ) + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: Prop, into buf: inout [UInt8]) { switch value { - - - case let .`key`(`value`): + case let .key(value): writeInt(&buf, Int32(1)) - FfiConverterString.write(`value`, into: &buf) - - - case let .`index`(`value`): + FfiConverterString.write(value, into: &buf) + + case let .index(value): writeInt(&buf, Int32(2)) - FfiConverterUInt64.write(`value`, into: &buf) - + FfiConverterUInt64.write(value, into: &buf) } } } - public func FfiConverterTypeProp_lift(_ buf: RustBuffer) throws -> Prop { - return try FfiConverterTypeProp.lift(buf) + try FfiConverterTypeProp.lift(buf) } public func FfiConverterTypeProp_lower(_ value: Prop) -> RustBuffer { - return FfiConverterTypeProp.lower(value) + FfiConverterTypeProp.lower(value) } - extension Prop: Equatable, Hashable {} - - public enum ReceiveSyncError { - - - // Simple error enums only carry a message case Internal(message: String) - + // Simple error enums only carry a message case InvalidMessage(message: String) - fileprivate static func uniffiErrorHandler(_ error: RustBuffer) throws -> Error { - return try FfiConverterTypeReceiveSyncError.lift(error) + try FfiConverterTypeReceiveSyncError.lift(error) } } - public struct FfiConverterTypeReceiveSyncError: FfiConverterRustBuffer { typealias SwiftType = ReceiveSyncError public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ReceiveSyncError { let variant: Int32 = try readInt(&buf) switch variant { + case 1: return try .Internal( + message: FfiConverterString.read(from: &buf) + ) - - - - case 1: return .Internal( - message: try FfiConverterString.read(from: &buf) - ) - - case 2: return .InvalidMessage( - message: try FfiConverterString.read(from: &buf) - ) - + case 2: return try .InvalidMessage( + message: FfiConverterString.read(from: &buf) + ) default: throw UniffiInternalError.unexpectedEnumCase } @@ -2071,39 +2056,31 @@ public struct FfiConverterTypeReceiveSyncError: FfiConverterRustBuffer { public static func write(_ value: ReceiveSyncError, into buf: inout [UInt8]) { switch value { - - - - case let .Internal(message): writeInt(&buf, Int32(1)) case let .InvalidMessage(message): writeInt(&buf, Int32(2)) - - } } } - extension ReceiveSyncError: Equatable, Hashable {} -extension ReceiveSyncError: Error { } +extension ReceiveSyncError: Error {} // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. public enum ScalarValue { - - case `bytes`(`value`: [UInt8]) - case `string`(`value`: String) - case `uint`(`value`: UInt64) - case `int`(`value`: Int64) - case `f64`(`value`: Double) - case `counter`(`value`: Int64) - case `timestamp`(`value`: Int64) - case `boolean`(`value`: Bool) - case `unknown`(`typeCode`: UInt8, `data`: [UInt8]) - case `null` + case bytes(value: [UInt8]) + case string(value: String) + case uint(value: UInt64) + case int(value: Int64) + case f64(value: Double) + case counter(value: Int64) + case timestamp(value: Int64) + case boolean(value: Bool) + case unknown(typeCode: UInt8, data: [UInt8]) + case null } public struct FfiConverterTypeScalarValue: FfiConverterRustBuffer { @@ -2112,127 +2089,109 @@ public struct FfiConverterTypeScalarValue: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ScalarValue { let variant: Int32 = try readInt(&buf) switch variant { - - case 1: return .`bytes`( - `value`: try FfiConverterSequenceUInt8.read(from: &buf) - ) - - case 2: return .`string`( - `value`: try FfiConverterString.read(from: &buf) - ) - - case 3: return .`uint`( - `value`: try FfiConverterUInt64.read(from: &buf) - ) - - case 4: return .`int`( - `value`: try FfiConverterInt64.read(from: &buf) - ) - - case 5: return .`f64`( - `value`: try FfiConverterDouble.read(from: &buf) - ) - - case 6: return .`counter`( - `value`: try FfiConverterInt64.read(from: &buf) - ) - - case 7: return .`timestamp`( - `value`: try FfiConverterInt64.read(from: &buf) - ) - - case 8: return .`boolean`( - `value`: try FfiConverterBool.read(from: &buf) - ) - - case 9: return .`unknown`( - `typeCode`: try FfiConverterUInt8.read(from: &buf), - `data`: try FfiConverterSequenceUInt8.read(from: &buf) - ) - - case 10: return .`null` - + case 1: return try .bytes( + value: FfiConverterSequenceUInt8.read(from: &buf) + ) + + case 2: return try .string( + value: FfiConverterString.read(from: &buf) + ) + + case 3: return try .uint( + value: FfiConverterUInt64.read(from: &buf) + ) + + case 4: return try .int( + value: FfiConverterInt64.read(from: &buf) + ) + + case 5: return try .f64( + value: FfiConverterDouble.read(from: &buf) + ) + + case 6: return try .counter( + value: FfiConverterInt64.read(from: &buf) + ) + + case 7: return try .timestamp( + value: FfiConverterInt64.read(from: &buf) + ) + + case 8: return try .boolean( + value: FfiConverterBool.read(from: &buf) + ) + + case 9: return try .unknown( + typeCode: FfiConverterUInt8.read(from: &buf), + data: FfiConverterSequenceUInt8.read(from: &buf) + ) + + case 10: return .null + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: ScalarValue, into buf: inout [UInt8]) { switch value { - - - case let .`bytes`(`value`): + case let .bytes(value): writeInt(&buf, Int32(1)) - FfiConverterSequenceUInt8.write(`value`, into: &buf) - - - case let .`string`(`value`): + FfiConverterSequenceUInt8.write(value, into: &buf) + + case let .string(value): writeInt(&buf, Int32(2)) - FfiConverterString.write(`value`, into: &buf) - - - case let .`uint`(`value`): + FfiConverterString.write(value, into: &buf) + + case let .uint(value): writeInt(&buf, Int32(3)) - FfiConverterUInt64.write(`value`, into: &buf) - - - case let .`int`(`value`): + FfiConverterUInt64.write(value, into: &buf) + + case let .int(value): writeInt(&buf, Int32(4)) - FfiConverterInt64.write(`value`, into: &buf) - - - case let .`f64`(`value`): + FfiConverterInt64.write(value, into: &buf) + + case let .f64(value): writeInt(&buf, Int32(5)) - FfiConverterDouble.write(`value`, into: &buf) - - - case let .`counter`(`value`): + FfiConverterDouble.write(value, into: &buf) + + case let .counter(value): writeInt(&buf, Int32(6)) - FfiConverterInt64.write(`value`, into: &buf) - - - case let .`timestamp`(`value`): + FfiConverterInt64.write(value, into: &buf) + + case let .timestamp(value): writeInt(&buf, Int32(7)) - FfiConverterInt64.write(`value`, into: &buf) - - - case let .`boolean`(`value`): + FfiConverterInt64.write(value, into: &buf) + + case let .boolean(value): writeInt(&buf, Int32(8)) - FfiConverterBool.write(`value`, into: &buf) - - - case let .`unknown`(`typeCode`,`data`): + FfiConverterBool.write(value, into: &buf) + + case let .unknown(typeCode, data): writeInt(&buf, Int32(9)) - FfiConverterUInt8.write(`typeCode`, into: &buf) - FfiConverterSequenceUInt8.write(`data`, into: &buf) - - - case .`null`: + FfiConverterUInt8.write(typeCode, into: &buf) + FfiConverterSequenceUInt8.write(data, into: &buf) + + case .null: writeInt(&buf, Int32(10)) - } } } - public func FfiConverterTypeScalarValue_lift(_ buf: RustBuffer) throws -> ScalarValue { - return try FfiConverterTypeScalarValue.lift(buf) + try FfiConverterTypeScalarValue.lift(buf) } public func FfiConverterTypeScalarValue_lower(_ value: ScalarValue) -> RustBuffer { - return FfiConverterTypeScalarValue.lower(value) + FfiConverterTypeScalarValue.lower(value) } - extension ScalarValue: Equatable, Hashable {} - - // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. public enum Value { - - case `object`(`typ`: ObjType, `id`: ObjId) - case `scalar`(`value`: ScalarValue) + case object(typ: ObjType, id: ObjId) + case scalar(value: ScalarValue) } public struct FfiConverterTypeValue: FfiConverterRustBuffer { @@ -2241,53 +2200,44 @@ public struct FfiConverterTypeValue: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Value { let variant: Int32 = try readInt(&buf) switch variant { - - case 1: return .`object`( - `typ`: try FfiConverterTypeObjType.read(from: &buf), - `id`: try FfiConverterTypeObjId.read(from: &buf) - ) - - case 2: return .`scalar`( - `value`: try FfiConverterTypeScalarValue.read(from: &buf) - ) - + case 1: return try .object( + typ: FfiConverterTypeObjType.read(from: &buf), + id: FfiConverterTypeObjId.read(from: &buf) + ) + + case 2: return try .scalar( + value: FfiConverterTypeScalarValue.read(from: &buf) + ) + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: Value, into buf: inout [UInt8]) { switch value { - - - case let .`object`(`typ`,`id`): + case let .object(typ, id): writeInt(&buf, Int32(1)) - FfiConverterTypeObjType.write(`typ`, into: &buf) - FfiConverterTypeObjId.write(`id`, into: &buf) - - - case let .`scalar`(`value`): + FfiConverterTypeObjType.write(typ, into: &buf) + FfiConverterTypeObjId.write(id, into: &buf) + + case let .scalar(value): writeInt(&buf, Int32(2)) - FfiConverterTypeScalarValue.write(`value`, into: &buf) - + FfiConverterTypeScalarValue.write(value, into: &buf) } } } - public func FfiConverterTypeValue_lift(_ buf: RustBuffer) throws -> Value { - return try FfiConverterTypeValue.lift(buf) + try FfiConverterTypeValue.lift(buf) } public func FfiConverterTypeValue_lower(_ value: Value) -> RustBuffer { - return FfiConverterTypeValue.lower(value) + FfiConverterTypeValue.lower(value) } - extension Value: Equatable, Hashable {} - - -fileprivate struct FfiConverterOptionTypeValue: FfiConverterRustBuffer { +private struct FfiConverterOptionTypeValue: FfiConverterRustBuffer { typealias SwiftType = Value? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -2308,7 +2258,7 @@ fileprivate struct FfiConverterOptionTypeValue: FfiConverterRustBuffer { } } -fileprivate struct FfiConverterOptionSequenceUInt8: FfiConverterRustBuffer { +private struct FfiConverterOptionSequenceUInt8: FfiConverterRustBuffer { typealias SwiftType = [UInt8]? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -2329,7 +2279,7 @@ fileprivate struct FfiConverterOptionSequenceUInt8: FfiConverterRustBuffer { } } -fileprivate struct FfiConverterOptionSequenceTypeChangeHash: FfiConverterRustBuffer { +private struct FfiConverterOptionSequenceTypeChangeHash: FfiConverterRustBuffer { typealias SwiftType = [ChangeHash]? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -2350,7 +2300,7 @@ fileprivate struct FfiConverterOptionSequenceTypeChangeHash: FfiConverterRustBuf } } -fileprivate struct FfiConverterSequenceUInt8: FfiConverterRustBuffer { +private struct FfiConverterSequenceUInt8: FfiConverterRustBuffer { typealias SwiftType = [UInt8] public static func write(_ value: [UInt8], into buf: inout [UInt8]) { @@ -2366,13 +2316,13 @@ fileprivate struct FfiConverterSequenceUInt8: FfiConverterRustBuffer { var seq = [UInt8]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - seq.append(try FfiConverterUInt8.read(from: &buf)) + try seq.append(FfiConverterUInt8.read(from: &buf)) } return seq } } -fileprivate struct FfiConverterSequenceString: FfiConverterRustBuffer { +private struct FfiConverterSequenceString: FfiConverterRustBuffer { typealias SwiftType = [String] public static func write(_ value: [String], into buf: inout [UInt8]) { @@ -2388,13 +2338,13 @@ fileprivate struct FfiConverterSequenceString: FfiConverterRustBuffer { var seq = [String]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - seq.append(try FfiConverterString.read(from: &buf)) + try seq.append(FfiConverterString.read(from: &buf)) } return seq } } -fileprivate struct FfiConverterSequenceTypeKeyValue: FfiConverterRustBuffer { +private struct FfiConverterSequenceTypeKeyValue: FfiConverterRustBuffer { typealias SwiftType = [KeyValue] public static func write(_ value: [KeyValue], into buf: inout [UInt8]) { @@ -2410,13 +2360,13 @@ fileprivate struct FfiConverterSequenceTypeKeyValue: FfiConverterRustBuffer { var seq = [KeyValue]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - seq.append(try FfiConverterTypeKeyValue.read(from: &buf)) + try seq.append(FfiConverterTypeKeyValue.read(from: &buf)) } return seq } } -fileprivate struct FfiConverterSequenceTypeMark: FfiConverterRustBuffer { +private struct FfiConverterSequenceTypeMark: FfiConverterRustBuffer { typealias SwiftType = [Mark] public static func write(_ value: [Mark], into buf: inout [UInt8]) { @@ -2432,13 +2382,13 @@ fileprivate struct FfiConverterSequenceTypeMark: FfiConverterRustBuffer { var seq = [Mark]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - seq.append(try FfiConverterTypeMark.read(from: &buf)) + try seq.append(FfiConverterTypeMark.read(from: &buf)) } return seq } } -fileprivate struct FfiConverterSequenceTypePatch: FfiConverterRustBuffer { +private struct FfiConverterSequenceTypePatch: FfiConverterRustBuffer { typealias SwiftType = [Patch] public static func write(_ value: [Patch], into buf: inout [UInt8]) { @@ -2454,13 +2404,13 @@ fileprivate struct FfiConverterSequenceTypePatch: FfiConverterRustBuffer { var seq = [Patch]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - seq.append(try FfiConverterTypePatch.read(from: &buf)) + try seq.append(FfiConverterTypePatch.read(from: &buf)) } return seq } } -fileprivate struct FfiConverterSequenceTypePathElement: FfiConverterRustBuffer { +private struct FfiConverterSequenceTypePathElement: FfiConverterRustBuffer { typealias SwiftType = [PathElement] public static func write(_ value: [PathElement], into buf: inout [UInt8]) { @@ -2476,13 +2426,13 @@ fileprivate struct FfiConverterSequenceTypePathElement: FfiConverterRustBuffer { var seq = [PathElement]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - seq.append(try FfiConverterTypePathElement.read(from: &buf)) + try seq.append(FfiConverterTypePathElement.read(from: &buf)) } return seq } } -fileprivate struct FfiConverterSequenceTypeScalarValue: FfiConverterRustBuffer { +private struct FfiConverterSequenceTypeScalarValue: FfiConverterRustBuffer { typealias SwiftType = [ScalarValue] public static func write(_ value: [ScalarValue], into buf: inout [UInt8]) { @@ -2498,13 +2448,13 @@ fileprivate struct FfiConverterSequenceTypeScalarValue: FfiConverterRustBuffer { var seq = [ScalarValue]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - seq.append(try FfiConverterTypeScalarValue.read(from: &buf)) + try seq.append(FfiConverterTypeScalarValue.read(from: &buf)) } return seq } } -fileprivate struct FfiConverterSequenceTypeValue: FfiConverterRustBuffer { +private struct FfiConverterSequenceTypeValue: FfiConverterRustBuffer { typealias SwiftType = [Value] public static func write(_ value: [Value], into buf: inout [UInt8]) { @@ -2520,13 +2470,13 @@ fileprivate struct FfiConverterSequenceTypeValue: FfiConverterRustBuffer { var seq = [Value]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - seq.append(try FfiConverterTypeValue.read(from: &buf)) + try seq.append(FfiConverterTypeValue.read(from: &buf)) } return seq } } -fileprivate struct FfiConverterSequenceTypeChangeHash: FfiConverterRustBuffer { +private struct FfiConverterSequenceTypeChangeHash: FfiConverterRustBuffer { typealias SwiftType = [ChangeHash] public static func write(_ value: [ChangeHash], into buf: inout [UInt8]) { @@ -2542,13 +2492,13 @@ fileprivate struct FfiConverterSequenceTypeChangeHash: FfiConverterRustBuffer { var seq = [ChangeHash]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - seq.append(try FfiConverterTypeChangeHash.read(from: &buf)) + try seq.append(FfiConverterTypeChangeHash.read(from: &buf)) } return seq } } -fileprivate struct FfiConverterDictionaryStringTypeValue: FfiConverterRustBuffer { +private struct FfiConverterDictionaryStringTypeValue: FfiConverterRustBuffer { public static func write(_ value: [String: Value], into buf: inout [UInt8]) { let len = Int32(value.count) writeInt(&buf, len) @@ -2562,7 +2512,7 @@ fileprivate struct FfiConverterDictionaryStringTypeValue: FfiConverterRustBuffer let len: Int32 = try readInt(&buf) var dict = [String: Value]() dict.reserveCapacity(Int(len)) - for _ in 0.. ActorId { - return try FfiConverterSequenceUInt8.read(from: &buf) + try FfiConverterSequenceUInt8.read(from: &buf) } public static func write(_ value: ActorId, into buf: inout [UInt8]) { - return FfiConverterSequenceUInt8.write(value, into: &buf) + FfiConverterSequenceUInt8.write(value, into: &buf) } public static func lift(_ value: RustBuffer) throws -> ActorId { - return try FfiConverterSequenceUInt8.lift(value) + try FfiConverterSequenceUInt8.lift(value) } public static func lower(_ value: ActorId) -> RustBuffer { - return FfiConverterSequenceUInt8.lower(value) + FfiConverterSequenceUInt8.lower(value) } } - /** * Typealias from the type name used in the UDL file to the builtin type. This * is needed because the UDL type name is used in function/method signatures. @@ -2603,23 +2551,22 @@ public struct FfiConverterTypeActorId: FfiConverter { public typealias ChangeHash = [UInt8] public struct FfiConverterTypeChangeHash: FfiConverter { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ChangeHash { - return try FfiConverterSequenceUInt8.read(from: &buf) + try FfiConverterSequenceUInt8.read(from: &buf) } public static func write(_ value: ChangeHash, into buf: inout [UInt8]) { - return FfiConverterSequenceUInt8.write(value, into: &buf) + FfiConverterSequenceUInt8.write(value, into: &buf) } public static func lift(_ value: RustBuffer) throws -> ChangeHash { - return try FfiConverterSequenceUInt8.lift(value) + try FfiConverterSequenceUInt8.lift(value) } public static func lower(_ value: ChangeHash) -> RustBuffer { - return FfiConverterSequenceUInt8.lower(value) + FfiConverterSequenceUInt8.lower(value) } } - /** * Typealias from the type name used in the UDL file to the builtin type. This * is needed because the UDL type name is used in function/method signatures. @@ -2627,23 +2574,22 @@ public struct FfiConverterTypeChangeHash: FfiConverter { public typealias Cursor = [UInt8] public struct FfiConverterTypeCursor: FfiConverter { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Cursor { - return try FfiConverterSequenceUInt8.read(from: &buf) + try FfiConverterSequenceUInt8.read(from: &buf) } public static func write(_ value: Cursor, into buf: inout [UInt8]) { - return FfiConverterSequenceUInt8.write(value, into: &buf) + FfiConverterSequenceUInt8.write(value, into: &buf) } public static func lift(_ value: RustBuffer) throws -> Cursor { - return try FfiConverterSequenceUInt8.lift(value) + try FfiConverterSequenceUInt8.lift(value) } public static func lower(_ value: Cursor) -> RustBuffer { - return FfiConverterSequenceUInt8.lower(value) + FfiConverterSequenceUInt8.lower(value) } } - /** * Typealias from the type name used in the UDL file to the builtin type. This * is needed because the UDL type name is used in function/method signatures. @@ -2651,27 +2597,27 @@ public struct FfiConverterTypeCursor: FfiConverter { public typealias ObjId = [UInt8] public struct FfiConverterTypeObjId: FfiConverter { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ObjId { - return try FfiConverterSequenceUInt8.read(from: &buf) + try FfiConverterSequenceUInt8.read(from: &buf) } public static func write(_ value: ObjId, into buf: inout [UInt8]) { - return FfiConverterSequenceUInt8.write(value, into: &buf) + FfiConverterSequenceUInt8.write(value, into: &buf) } public static func lift(_ value: RustBuffer) throws -> ObjId { - return try FfiConverterSequenceUInt8.lift(value) + try FfiConverterSequenceUInt8.lift(value) } public static func lower(_ value: ObjId) -> RustBuffer { - return FfiConverterSequenceUInt8.lower(value) + FfiConverterSequenceUInt8.lower(value) } } -public func `root`() -> ObjId { - return try! FfiConverterTypeObjId.lift( - try! rustCall() { - uniffi_automerge_fn_func_root($0) -} +public func root() -> ObjId { + try! FfiConverterTypeObjId.lift( + try! rustCall { + uniffi_automerge_fn_func_root($0) + } ) } @@ -2680,6 +2626,7 @@ private enum InitializationResult { case contractVersionMismatch case apiChecksumMismatch } + // Use a global variables to perform the versioning checks. Swift ensures that // the code inside is only computed once. private var initializationResult: InitializationResult { @@ -2690,196 +2637,196 @@ private var initializationResult: InitializationResult { if bindings_contract_version != scaffolding_contract_version { return InitializationResult.contractVersionMismatch } - if (uniffi_automerge_checksum_func_root() != 26077) { + if uniffi_automerge_checksum_func_root() != 26077 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_syncstate_encode() != 59150) { + if uniffi_automerge_checksum_method_syncstate_encode() != 59150 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_syncstate_reset() != 5568) { + if uniffi_automerge_checksum_method_syncstate_reset() != 5568 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_syncstate_their_heads() != 64411) { + if uniffi_automerge_checksum_method_syncstate_their_heads() != 64411 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_actor_id() != 11490) { + if uniffi_automerge_checksum_method_doc_actor_id() != 11490 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_set_actor() != 35416) { + if uniffi_automerge_checksum_method_doc_set_actor() != 35416 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_fork() != 25657) { + if uniffi_automerge_checksum_method_doc_fork() != 25657 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_fork_at() != 50476) { + if uniffi_automerge_checksum_method_doc_fork_at() != 50476 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_put_in_map() != 35151) { + if uniffi_automerge_checksum_method_doc_put_in_map() != 35151 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_put_object_in_map() != 62590) { + if uniffi_automerge_checksum_method_doc_put_object_in_map() != 62590 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_put_in_list() != 4528) { + if uniffi_automerge_checksum_method_doc_put_in_list() != 4528 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_put_object_in_list() != 12042) { + if uniffi_automerge_checksum_method_doc_put_object_in_list() != 12042 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_insert_in_list() != 50457) { + if uniffi_automerge_checksum_method_doc_insert_in_list() != 50457 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_insert_object_in_list() != 44319) { + if uniffi_automerge_checksum_method_doc_insert_object_in_list() != 44319 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_splice_text() != 50590) { + if uniffi_automerge_checksum_method_doc_splice_text() != 50590 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_splice() != 26727) { + if uniffi_automerge_checksum_method_doc_splice() != 26727 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_mark() != 20101) { + if uniffi_automerge_checksum_method_doc_mark() != 20101 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_marks() != 22398) { + if uniffi_automerge_checksum_method_doc_marks() != 22398 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_marks_at() != 56398) { + if uniffi_automerge_checksum_method_doc_marks_at() != 56398 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_delete_in_map() != 14795) { + if uniffi_automerge_checksum_method_doc_delete_in_map() != 14795 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_delete_in_list() != 11486) { + if uniffi_automerge_checksum_method_doc_delete_in_list() != 11486 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_increment_in_map() != 10806) { + if uniffi_automerge_checksum_method_doc_increment_in_map() != 10806 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_increment_in_list() != 11835) { + if uniffi_automerge_checksum_method_doc_increment_in_list() != 11835 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_get_in_map() != 29552) { + if uniffi_automerge_checksum_method_doc_get_in_map() != 29552 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_get_in_list() != 15714) { + if uniffi_automerge_checksum_method_doc_get_in_list() != 15714 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_get_at_in_map() != 4821) { + if uniffi_automerge_checksum_method_doc_get_at_in_map() != 4821 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_get_at_in_list() != 35364) { + if uniffi_automerge_checksum_method_doc_get_at_in_list() != 35364 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_get_all_in_map() != 65368) { + if uniffi_automerge_checksum_method_doc_get_all_in_map() != 65368 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_get_all_in_list() != 9030) { + if uniffi_automerge_checksum_method_doc_get_all_in_list() != 9030 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_get_all_at_in_map() != 60892) { + if uniffi_automerge_checksum_method_doc_get_all_at_in_map() != 60892 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_get_all_at_in_list() != 65173) { + if uniffi_automerge_checksum_method_doc_get_all_at_in_list() != 65173 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_text() != 64459) { + if uniffi_automerge_checksum_method_doc_text() != 64459 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_text_at() != 64255) { + if uniffi_automerge_checksum_method_doc_text_at() != 64255 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_map_keys() != 53447) { + if uniffi_automerge_checksum_method_doc_map_keys() != 53447 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_map_keys_at() != 37789) { + if uniffi_automerge_checksum_method_doc_map_keys_at() != 37789 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_map_entries() != 35449) { + if uniffi_automerge_checksum_method_doc_map_entries() != 35449 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_map_entries_at() != 19141) { + if uniffi_automerge_checksum_method_doc_map_entries_at() != 19141 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_values() != 34066) { + if uniffi_automerge_checksum_method_doc_values() != 34066 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_values_at() != 26130) { + if uniffi_automerge_checksum_method_doc_values_at() != 26130 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_length() != 24325) { + if uniffi_automerge_checksum_method_doc_length() != 24325 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_length_at() != 12090) { + if uniffi_automerge_checksum_method_doc_length_at() != 12090 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_object_type() != 62959) { + if uniffi_automerge_checksum_method_doc_object_type() != 62959 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_path() != 39894) { + if uniffi_automerge_checksum_method_doc_path() != 39894 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_heads() != 41278) { + if uniffi_automerge_checksum_method_doc_heads() != 41278 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_changes() != 11521) { + if uniffi_automerge_checksum_method_doc_changes() != 11521 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_save() != 57703) { + if uniffi_automerge_checksum_method_doc_save() != 57703 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_merge() != 42744) { + if uniffi_automerge_checksum_method_doc_merge() != 42744 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_merge_with_patches() != 34457) { + if uniffi_automerge_checksum_method_doc_merge_with_patches() != 34457 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_generate_sync_message() != 17944) { + if uniffi_automerge_checksum_method_doc_generate_sync_message() != 17944 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_receive_sync_message() != 35482) { + if uniffi_automerge_checksum_method_doc_receive_sync_message() != 35482 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_receive_sync_message_with_patches() != 36417) { + if uniffi_automerge_checksum_method_doc_receive_sync_message_with_patches() != 36417 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_encode_new_changes() != 27855) { + if uniffi_automerge_checksum_method_doc_encode_new_changes() != 27855 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_encode_changes_since() != 54354) { + if uniffi_automerge_checksum_method_doc_encode_changes_since() != 54354 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_apply_encoded_changes() != 54766) { + if uniffi_automerge_checksum_method_doc_apply_encoded_changes() != 54766 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_apply_encoded_changes_with_patches() != 531) { + if uniffi_automerge_checksum_method_doc_apply_encoded_changes_with_patches() != 531 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_cursor() != 65444) { + if uniffi_automerge_checksum_method_doc_cursor() != 65444 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_cursor_at() != 10421) { + if uniffi_automerge_checksum_method_doc_cursor_at() != 10421 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_cursor_position() != 22039) { + if uniffi_automerge_checksum_method_doc_cursor_position() != 22039 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_method_doc_cursor_position_at() != 17946) { + if uniffi_automerge_checksum_method_doc_cursor_position_at() != 17946 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_constructor_syncstate_new() != 17106) { + if uniffi_automerge_checksum_constructor_syncstate_new() != 17106 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_constructor_syncstate_decode() != 23331) { + if uniffi_automerge_checksum_constructor_syncstate_decode() != 23331 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_constructor_doc_new() != 17962) { + if uniffi_automerge_checksum_constructor_doc_new() != 17962 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_constructor_doc_new_with_actor() != 23025) { + if uniffi_automerge_checksum_constructor_doc_new_with_actor() != 23025 { return InitializationResult.apiChecksumMismatch } - if (uniffi_automerge_checksum_constructor_doc_load() != 35192) { + if uniffi_automerge_checksum_constructor_doc_load() != 35192 { return InitializationResult.apiChecksumMismatch } @@ -2895,4 +2842,4 @@ private func uniffiEnsureInitialized() { case .apiChecksumMismatch: fatalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project") } -} \ No newline at end of file +} diff --git a/Package.swift b/Package.swift index 56768752..5b9d1260 100644 --- a/Package.swift +++ b/Package.swift @@ -51,8 +51,8 @@ if ProcessInfo.processInfo.environment["LOCAL_BUILD"] != nil { } else { FFIbinaryTarget = .binaryTarget( name: "automergeFFI", - url: "https://github.com/automerge/automerge-swift/releases/download/0.5.0-alpha3/automergeFFI.xcframework.zip", - checksum: "f9e96b1b76c1a4e273a3b968e82c24bf77fd00fc21b0120b462ece4c0022fddb" + url: "https://github.com/automerge/automerge-swift/releases/download/0.5.0-alpha4/automergeFFI.xcframework.zip", + checksum: "87aabda4ebbf5d59e0a92aaff10424a3151d30ccb1b73f6e37b729e1499716c4" ) }