Skip to content

Commit f0144bd

Browse files
committed
Bump to v1.0.23-alpha (matrix-rust-sdk e4257f9aff247543b8dfda5f8b5df37adfa72224)
1 parent caea4ca commit f0144bd

File tree

2 files changed

+86
-80
lines changed

2 files changed

+86
-80
lines changed

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
import PackageDescription
55

6-
let checksum = "93d86da0d1ca36a11dc8393f50bdc6c12def6c669b6c6bb2ae482641ffc052e3"
7-
let version = "v1.0.22-alpha"
6+
let checksum = "93715098185ee35f44c698091f6a665ed88745d95522e16b2593e1fe6c431d9b"
7+
let version = "v1.0.23-alpha"
88
let url = "https://github.com/matrix-org/matrix-rust-components-swift/releases/download/\(version)/MatrixSDKFFI.xcframework.zip"
99

1010
let package = Package(

Sources/MatrixRustSDK/matrix_sdk_ffi.swift

Lines changed: 84 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,19 @@ fileprivate struct FfiConverterUInt32: FfiConverterPrimitive {
319319
}
320320
}
321321

322+
fileprivate struct FfiConverterInt32: FfiConverterPrimitive {
323+
typealias FfiType = Int32
324+
typealias SwiftType = Int32
325+
326+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Int32 {
327+
return try lift(readInt(&buf))
328+
}
329+
330+
public static func write(_ value: Int32, into buf: inout [UInt8]) {
331+
writeInt(&buf, lower(value))
332+
}
333+
}
334+
322335
fileprivate struct FfiConverterUInt64: FfiConverterPrimitive {
323336
typealias FfiType = UInt64
324337
typealias SwiftType = UInt64
@@ -2952,7 +2965,7 @@ public class TimelineItem: TimelineItemProtocol {
29522965
try!
29532966
rustCall() {
29542967

2955-
_uniffi_matrix_sdk_ffi_impl_TimelineItem_as_virtual_e50d(self.pointer, $0
2968+
_uniffi_matrix_sdk_ffi_impl_TimelineItem_as_virtual_c1a3(self.pointer, $0
29562969
)
29572970
}
29582971
)
@@ -3180,62 +3193,6 @@ public struct FfiConverterTypeUnreadNotificationsCount: FfiConverter {
31803193
}
31813194

31823195

3183-
public protocol VirtualTimelineItemProtocol {
3184-
3185-
}
3186-
3187-
public class VirtualTimelineItem: VirtualTimelineItemProtocol {
3188-
fileprivate let pointer: UnsafeMutableRawPointer
3189-
3190-
// TODO: We'd like this to be `private` but for Swifty reasons,
3191-
// we can't implement `FfiConverter` without making this `required` and we can't
3192-
// make it `required` without making it `public`.
3193-
required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
3194-
self.pointer = pointer
3195-
}
3196-
3197-
deinit {
3198-
try! rustCall { _uniffi_matrix_sdk_ffi_object_free_VirtualTimelineItem_21e1(pointer, $0) }
3199-
}
3200-
3201-
3202-
3203-
3204-
3205-
}
3206-
3207-
3208-
public struct FfiConverterTypeVirtualTimelineItem: FfiConverter {
3209-
typealias FfiType = UnsafeMutableRawPointer
3210-
typealias SwiftType = VirtualTimelineItem
3211-
3212-
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> VirtualTimelineItem {
3213-
let v: UInt64 = try readInt(&buf)
3214-
// The Rust code won't compile if a pointer won't fit in a UInt64.
3215-
// We have to go via `UInt` because that's the thing that's the size of a pointer.
3216-
let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
3217-
if (ptr == nil) {
3218-
throw UniffiInternalError.unexpectedNullPointer
3219-
}
3220-
return try lift(ptr!)
3221-
}
3222-
3223-
public static func write(_ value: VirtualTimelineItem, into buf: inout [UInt8]) {
3224-
// This fiddling is because `Int` is the thing that's the same size as a pointer.
3225-
// The Rust code won't compile if a pointer won't fit in a `UInt64`.
3226-
writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
3227-
}
3228-
3229-
public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> VirtualTimelineItem {
3230-
return VirtualTimelineItem(unsafeFromRawPointer: pointer)
3231-
}
3232-
3233-
public static func lower(_ value: VirtualTimelineItem) -> UnsafeMutableRawPointer {
3234-
return value.pointer
3235-
}
3236-
}
3237-
3238-
32393196
public struct EmoteMessageContent {
32403197
public var `body`: String
32413198
public var `formatted`: FormattedBody?
@@ -4890,6 +4847,55 @@ public struct FfiConverterTypeTimelineKey: FfiConverterRustBuffer {
48904847
extension TimelineKey: Equatable, Hashable {}
48914848

48924849

4850+
// Note that we don't yet support `indirect` for enums.
4851+
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
4852+
public enum VirtualTimelineItem {
4853+
4854+
case `dayDivider`(`year`: Int32, `month`: UInt32, `day`: UInt32)
4855+
case `readMarker`
4856+
}
4857+
4858+
public struct FfiConverterTypeVirtualTimelineItem: FfiConverterRustBuffer {
4859+
typealias SwiftType = VirtualTimelineItem
4860+
4861+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> VirtualTimelineItem {
4862+
let variant: Int32 = try readInt(&buf)
4863+
switch variant {
4864+
4865+
case 1: return .`dayDivider`(
4866+
`year`: try FfiConverterInt32.read(from: &buf),
4867+
`month`: try FfiConverterUInt32.read(from: &buf),
4868+
`day`: try FfiConverterUInt32.read(from: &buf)
4869+
)
4870+
4871+
case 2: return .`readMarker`
4872+
4873+
default: throw UniffiInternalError.unexpectedEnumCase
4874+
}
4875+
}
4876+
4877+
public static func write(_ value: VirtualTimelineItem, into buf: inout [UInt8]) {
4878+
switch value {
4879+
4880+
4881+
case let .`dayDivider`(`year`,`month`,`day`):
4882+
writeInt(&buf, Int32(1))
4883+
FfiConverterInt32.write(`year`, into: &buf)
4884+
FfiConverterUInt32.write(`month`, into: &buf)
4885+
FfiConverterUInt32.write(`day`, into: &buf)
4886+
4887+
4888+
case .`readMarker`:
4889+
writeInt(&buf, Int32(2))
4890+
4891+
}
4892+
}
4893+
}
4894+
4895+
4896+
extension VirtualTimelineItem: Equatable, Hashable {}
4897+
4898+
48934899

48944900
public enum AuthenticationError {
48954901

@@ -6361,27 +6367,6 @@ fileprivate struct FfiConverterOptionTypeTimelineItem: FfiConverterRustBuffer {
63616367
}
63626368
}
63636369

6364-
fileprivate struct FfiConverterOptionTypeVirtualTimelineItem: FfiConverterRustBuffer {
6365-
typealias SwiftType = VirtualTimelineItem?
6366-
6367-
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
6368-
guard let value = value else {
6369-
writeInt(&buf, Int8(0))
6370-
return
6371-
}
6372-
writeInt(&buf, Int8(1))
6373-
FfiConverterTypeVirtualTimelineItem.write(value, into: &buf)
6374-
}
6375-
6376-
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
6377-
switch try readInt(&buf) as Int8 {
6378-
case 0: return nil
6379-
case 1: return try FfiConverterTypeVirtualTimelineItem.read(from: &buf)
6380-
default: throw UniffiInternalError.unexpectedOptionalTag
6381-
}
6382-
}
6383-
}
6384-
63856370
fileprivate struct FfiConverterOptionTypeFileInfo: FfiConverterRustBuffer {
63866371
typealias SwiftType = FileInfo?
63876372

@@ -6613,6 +6598,27 @@ fileprivate struct FfiConverterOptionTypeMessageType: FfiConverterRustBuffer {
66136598
}
66146599
}
66156600

6601+
fileprivate struct FfiConverterOptionTypeVirtualTimelineItem: FfiConverterRustBuffer {
6602+
typealias SwiftType = VirtualTimelineItem?
6603+
6604+
public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
6605+
guard let value = value else {
6606+
writeInt(&buf, Int8(0))
6607+
return
6608+
}
6609+
writeInt(&buf, Int8(1))
6610+
FfiConverterTypeVirtualTimelineItem.write(value, into: &buf)
6611+
}
6612+
6613+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
6614+
switch try readInt(&buf) as Int8 {
6615+
case 0: return nil
6616+
case 1: return try FfiConverterTypeVirtualTimelineItem.read(from: &buf)
6617+
default: throw UniffiInternalError.unexpectedOptionalTag
6618+
}
6619+
}
6620+
}
6621+
66166622
fileprivate struct FfiConverterOptionCallbackInterfaceClientDelegate: FfiConverterRustBuffer {
66176623
typealias SwiftType = ClientDelegate?
66186624

0 commit comments

Comments
 (0)