Skip to content

Commit

Permalink
Update Bbqr.swift and Package.swift for release 0.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
runner authored and runner committed Jun 11, 2024
1 parent 6eb9a9b commit 83b8280
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 57 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ let package = Package(
.binaryTarget(
name: "bbqrffiFFI",
url: "https://github.com/bitcoinppl/bbqr-swift/releases/download/0.3.1/Bbqr.xcframework.zip",
checksum: "203f209779393670627eb123dde09e5f54e3fce8eccfc1b631399a91e4112fae"
checksum: "206f6ef409042c1065f36ad1230b3e640cae067a4e08bb655bc46f37c6bccd97"
),
.target(
name: "Bbqr",
Expand Down
62 changes: 6 additions & 56 deletions Sources/Bbqr/Bbqr.swift
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ open class ContinuousJoiner:
}

open func addPart(part: String) throws -> ContinuousJoinResult {
return try FfiConverterTypeContinuousJoinResult.lift(rustCallWithError(FfiConverterTypeContinuousJoinError.lift) {
return try FfiConverterTypeContinuousJoinResult.lift(rustCallWithError(FfiConverterTypeJoinError.lift) {
uniffi_bbqrffi_fn_method_continuousjoiner_add_part(self.uniffiClonePointer(),
FfiConverterString.lower(part), $0)
})
Expand Down Expand Up @@ -847,64 +847,14 @@ public func FfiConverterTypeSplitOptions_lower(_ value: SplitOptions) -> RustBuf
return FfiConverterTypeSplitOptions.lower(value)
}

public enum ContinuousJoinError {
case HeaderParseError(error: HeaderParseError
)
case JoinError(error: JoinError
)
case DecodeError(error: DecodeError
)
}

public struct FfiConverterTypeContinuousJoinError: FfiConverterRustBuffer {
typealias SwiftType = ContinuousJoinError

public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ContinuousJoinError {
let variant: Int32 = try readInt(&buf)
switch variant {
case 1: return try .HeaderParseError(
error: FfiConverterTypeHeaderParseError.read(from: &buf)
)
case 2: return try .JoinError(
error: FfiConverterTypeJoinError.read(from: &buf)
)
case 3: return try .DecodeError(
error: FfiConverterTypeDecodeError.read(from: &buf)
)

default: throw UniffiInternalError.unexpectedEnumCase
}
}

public static func write(_ value: ContinuousJoinError, into buf: inout [UInt8]) {
switch value {
case let .HeaderParseError(error):
writeInt(&buf, Int32(1))
FfiConverterTypeHeaderParseError.write(error, into: &buf)

case let .JoinError(error):
writeInt(&buf, Int32(2))
FfiConverterTypeJoinError.write(error, into: &buf)

case let .DecodeError(error):
writeInt(&buf, Int32(3))
FfiConverterTypeDecodeError.write(error, into: &buf)
}
}
}

extension ContinuousJoinError: Equatable, Hashable {}

extension ContinuousJoinError: 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 ContinuousJoinResult {
case notStarted
case inProgress(partsLeft: UInt16
)
case complete(Joined
case complete(joined: Joined
)
}

Expand All @@ -919,7 +869,7 @@ public struct FfiConverterTypeContinuousJoinResult: FfiConverterRustBuffer {
case 2: return try .inProgress(partsLeft: FfiConverterUInt16.read(from: &buf)
)

case 3: return try .complete(FfiConverterTypeJoined.read(from: &buf)
case 3: return try .complete(joined: FfiConverterTypeJoined.read(from: &buf)
)

default: throw UniffiInternalError.unexpectedEnumCase
Expand All @@ -935,9 +885,9 @@ public struct FfiConverterTypeContinuousJoinResult: FfiConverterRustBuffer {
writeInt(&buf, Int32(2))
FfiConverterUInt16.write(partsLeft, into: &buf)

case let .complete(v1):
case let .complete(joined):
writeInt(&buf, Int32(3))
FfiConverterTypeJoined.write(v1, into: &buf)
FfiConverterTypeJoined.write(joined, into: &buf)
}
}
}
Expand Down Expand Up @@ -1717,7 +1667,7 @@ private var initializationResult: InitializationResult {
if uniffi_bbqrffi_checksum_func_default_split_options() != 18092 {
return InitializationResult.apiChecksumMismatch
}
if uniffi_bbqrffi_checksum_method_continuousjoiner_add_part() != 37717 {
if uniffi_bbqrffi_checksum_method_continuousjoiner_add_part() != 26183 {
return InitializationResult.apiChecksumMismatch
}
if uniffi_bbqrffi_checksum_method_joined_data() != 37507 {
Expand Down

0 comments on commit 83b8280

Please sign in to comment.