@@ -319,6 +319,19 @@ fileprivate struct FfiConverterUInt32: FfiConverterPrimitive {
319
319
}
320
320
}
321
321
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
+
322
335
fileprivate struct FfiConverterUInt64 : FfiConverterPrimitive {
323
336
typealias FfiType = UInt64
324
337
typealias SwiftType = UInt64
@@ -2952,7 +2965,7 @@ public class TimelineItem: TimelineItemProtocol {
2952
2965
try !
2953
2966
rustCall ( ) {
2954
2967
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
2956
2969
)
2957
2970
}
2958
2971
)
@@ -3180,62 +3193,6 @@ public struct FfiConverterTypeUnreadNotificationsCount: FfiConverter {
3180
3193
}
3181
3194
3182
3195
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
-
3239
3196
public struct EmoteMessageContent {
3240
3197
public var `body` : String
3241
3198
public var `formatted` : FormattedBody ?
@@ -4890,6 +4847,55 @@ public struct FfiConverterTypeTimelineKey: FfiConverterRustBuffer {
4890
4847
extension TimelineKey : Equatable , Hashable { }
4891
4848
4892
4849
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
+
4893
4899
4894
4900
public enum AuthenticationError {
4895
4901
@@ -6361,27 +6367,6 @@ fileprivate struct FfiConverterOptionTypeTimelineItem: FfiConverterRustBuffer {
6361
6367
}
6362
6368
}
6363
6369
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
-
6385
6370
fileprivate struct FfiConverterOptionTypeFileInfo : FfiConverterRustBuffer {
6386
6371
typealias SwiftType = FileInfo ?
6387
6372
@@ -6613,6 +6598,27 @@ fileprivate struct FfiConverterOptionTypeMessageType: FfiConverterRustBuffer {
6613
6598
}
6614
6599
}
6615
6600
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
+
6616
6622
fileprivate struct FfiConverterOptionCallbackInterfaceClientDelegate : FfiConverterRustBuffer {
6617
6623
typealias SwiftType = ClientDelegate ?
6618
6624
0 commit comments