@@ -419,201 +419,6 @@ fileprivate struct FfiConverterString: FfiConverter {
419
419
}
420
420
}
421
421
422
-
423
- /**
424
- * Current draft of the composer for the room.
425
- */
426
- public struct ComposerDraft {
427
- /**
428
- * The draft content in plain text.
429
- */
430
- public var plainText : String
431
- /**
432
- * If the message is formatted in HTML, the HTML representation of the
433
- * message.
434
- */
435
- public var htmlText : String ?
436
- /**
437
- * The type of draft.
438
- */
439
- public var draftType : ComposerDraftType
440
-
441
- // Default memberwise initializers are never public by default, so we
442
- // declare one manually.
443
- public init (
444
- /**
445
- * The draft content in plain text.
446
- */plainText: String ,
447
- /**
448
- * If the message is formatted in HTML, the HTML representation of the
449
- * message.
450
- */htmlText: String ? ,
451
- /**
452
- * The type of draft.
453
- */draftType: ComposerDraftType ) {
454
- self . plainText = plainText
455
- self . htmlText = htmlText
456
- self . draftType = draftType
457
- }
458
- }
459
-
460
-
461
-
462
- extension ComposerDraft : Equatable , Hashable {
463
- public static func == ( lhs: ComposerDraft , rhs: ComposerDraft ) -> Bool {
464
- if lhs. plainText != rhs. plainText {
465
- return false
466
- }
467
- if lhs. htmlText != rhs. htmlText {
468
- return false
469
- }
470
- if lhs. draftType != rhs. draftType {
471
- return false
472
- }
473
- return true
474
- }
475
-
476
- public func hash( into hasher: inout Hasher ) {
477
- hasher. combine ( plainText)
478
- hasher. combine ( htmlText)
479
- hasher. combine ( draftType)
480
- }
481
- }
482
-
483
-
484
- public struct FfiConverterTypeComposerDraft : FfiConverterRustBuffer {
485
- public static func read( from buf: inout ( data: Data , offset: Data . Index ) ) throws -> ComposerDraft {
486
- return
487
- try ComposerDraft (
488
- plainText: FfiConverterString . read ( from: & buf) ,
489
- htmlText: FfiConverterOptionString . read ( from: & buf) ,
490
- draftType: FfiConverterTypeComposerDraftType . read ( from: & buf)
491
- )
492
- }
493
-
494
- public static func write( _ value: ComposerDraft , into buf: inout [ UInt8 ] ) {
495
- FfiConverterString . write ( value. plainText, into: & buf)
496
- FfiConverterOptionString . write ( value. htmlText, into: & buf)
497
- FfiConverterTypeComposerDraftType . write ( value. draftType, into: & buf)
498
- }
499
- }
500
-
501
-
502
- public func FfiConverterTypeComposerDraft_lift( _ buf: RustBuffer ) throws -> ComposerDraft {
503
- return try FfiConverterTypeComposerDraft . lift ( buf)
504
- }
505
-
506
- public func FfiConverterTypeComposerDraft_lower( _ value: ComposerDraft ) -> RustBuffer {
507
- return FfiConverterTypeComposerDraft . lower ( value)
508
- }
509
-
510
- // Note that we don't yet support `indirect` for enums.
511
- // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
512
- /**
513
- * The type of draft of the composer.
514
- */
515
-
516
- public enum ComposerDraftType {
517
-
518
- /**
519
- * The draft is a new message.
520
- */
521
- case newMessage
522
- /**
523
- * The draft is a reply to an event.
524
- */
525
- case reply(
526
- /**
527
- * The ID of the event being replied to.
528
- */eventId: String
529
- )
530
- /**
531
- * The draft is an edit of an event.
532
- */
533
- case edit(
534
- /**
535
- * The ID of the event being edited.
536
- */eventId: String
537
- )
538
- }
539
-
540
-
541
- public struct FfiConverterTypeComposerDraftType : FfiConverterRustBuffer {
542
- typealias SwiftType = ComposerDraftType
543
-
544
- public static func read( from buf: inout ( data: Data , offset: Data . Index ) ) throws -> ComposerDraftType {
545
- let variant : Int32 = try readInt ( & buf)
546
- switch variant {
547
-
548
- case 1 : return . newMessage
549
-
550
- case 2 : return . reply( eventId: try FfiConverterString . read ( from: & buf)
551
- )
552
-
553
- case 3 : return . edit( eventId: try FfiConverterString . read ( from: & buf)
554
- )
555
-
556
- default : throw UniffiInternalError . unexpectedEnumCase
557
- }
558
- }
559
-
560
- public static func write( _ value: ComposerDraftType , into buf: inout [ UInt8 ] ) {
561
- switch value {
562
-
563
-
564
- case . newMessage:
565
- writeInt ( & buf, Int32 ( 1 ) )
566
-
567
-
568
- case let . reply( eventId) :
569
- writeInt ( & buf, Int32 ( 2 ) )
570
- FfiConverterString . write ( eventId, into: & buf)
571
-
572
-
573
- case let . edit( eventId) :
574
- writeInt ( & buf, Int32 ( 3 ) )
575
- FfiConverterString . write ( eventId, into: & buf)
576
-
577
- }
578
- }
579
- }
580
-
581
-
582
- public func FfiConverterTypeComposerDraftType_lift( _ buf: RustBuffer ) throws -> ComposerDraftType {
583
- return try FfiConverterTypeComposerDraftType . lift ( buf)
584
- }
585
-
586
- public func FfiConverterTypeComposerDraftType_lower( _ value: ComposerDraftType ) -> RustBuffer {
587
- return FfiConverterTypeComposerDraftType . lower ( value)
588
- }
589
-
590
-
591
-
592
- extension ComposerDraftType : Equatable , Hashable { }
593
-
594
-
595
-
596
- fileprivate struct FfiConverterOptionString : FfiConverterRustBuffer {
597
- typealias SwiftType = String ?
598
-
599
- public static func write( _ value: SwiftType , into buf: inout [ UInt8 ] ) {
600
- guard let value = value else {
601
- writeInt ( & buf, Int8 ( 0 ) )
602
- return
603
- }
604
- writeInt ( & buf, Int8 ( 1 ) )
605
- FfiConverterString . write ( value, into: & buf)
606
- }
607
-
608
- public static func read( from buf: inout ( data: Data , offset: Data . Index ) ) throws -> SwiftType {
609
- switch try readInt ( & buf) as Int8 {
610
- case 0 : return nil
611
- case 1 : return try FfiConverterString . read ( from: & buf)
612
- default : throw UniffiInternalError . unexpectedOptionalTag
613
- }
614
- }
615
- }
616
-
617
422
private enum InitializationResult {
618
423
case ok
619
424
case contractVersionMismatch
0 commit comments