@@ -503,6 +503,122 @@ extension LocalTrust: Equatable, Hashable {}
503503
504504
505505
506+ // Note that we don't yet support `indirect` for enums.
507+ // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
508+ /**
509+ * Error type for the decoding of the [`QrCodeData`].
510+ */
511+
512+ public enum LoginQrCodeDecodeError {
513+
514+ /**
515+ * The QR code data is no long enough, it's missing some fields.
516+ */
517+ case notEnoughData
518+ /**
519+ * One of the URLs in the QR code data is not a valid UTF-8 encoded string.
520+ */
521+ case notUtf8
522+ /**
523+ * One of the URLs in the QR code data could not be parsed.
524+ */
525+ case urlParse
526+ /**
527+ * The QR code data contains an invalid mode, we expect the login (0x03)
528+ * mode or the reciprocate mode (0x04).
529+ */
530+ case invalidMode
531+ /**
532+ * The QR code data contains an unsupported version.
533+ */
534+ case invalidVersion
535+ /**
536+ * The base64 encoded variant of the QR code data is not a valid base64
537+ * string.
538+ */
539+ case base64
540+ /**
541+ * The QR code data doesn't contain the expected `MATRIX` prefix.
542+ */
543+ case invalidPrefix
544+ }
545+
546+
547+ public struct FfiConverterTypeLoginQrCodeDecodeError : FfiConverterRustBuffer {
548+ typealias SwiftType = LoginQrCodeDecodeError
549+
550+ public static func read( from buf: inout ( data: Data , offset: Data . Index ) ) throws -> LoginQrCodeDecodeError {
551+ let variant : Int32 = try readInt ( & buf)
552+ switch variant {
553+
554+ case 1 : return . notEnoughData
555+
556+ case 2 : return . notUtf8
557+
558+ case 3 : return . urlParse
559+
560+ case 4 : return . invalidMode
561+
562+ case 5 : return . invalidVersion
563+
564+ case 6 : return . base64
565+
566+ case 7 : return . invalidPrefix
567+
568+ default : throw UniffiInternalError . unexpectedEnumCase
569+ }
570+ }
571+
572+ public static func write( _ value: LoginQrCodeDecodeError , into buf: inout [ UInt8 ] ) {
573+ switch value {
574+
575+
576+ case . notEnoughData:
577+ writeInt ( & buf, Int32 ( 1 ) )
578+
579+
580+ case . notUtf8:
581+ writeInt ( & buf, Int32 ( 2 ) )
582+
583+
584+ case . urlParse:
585+ writeInt ( & buf, Int32 ( 3 ) )
586+
587+
588+ case . invalidMode:
589+ writeInt ( & buf, Int32 ( 4 ) )
590+
591+
592+ case . invalidVersion:
593+ writeInt ( & buf, Int32 ( 5 ) )
594+
595+
596+ case . base64:
597+ writeInt ( & buf, Int32 ( 6 ) )
598+
599+
600+ case . invalidPrefix:
601+ writeInt ( & buf, Int32 ( 7 ) )
602+
603+ }
604+ }
605+ }
606+
607+
608+ public func FfiConverterTypeLoginQrCodeDecodeError_lift( _ buf: RustBuffer ) throws -> LoginQrCodeDecodeError {
609+ return try FfiConverterTypeLoginQrCodeDecodeError . lift ( buf)
610+ }
611+
612+ public func FfiConverterTypeLoginQrCodeDecodeError_lower( _ value: LoginQrCodeDecodeError ) -> RustBuffer {
613+ return FfiConverterTypeLoginQrCodeDecodeError . lower ( value)
614+ }
615+
616+
617+
618+ extension LoginQrCodeDecodeError : Equatable , Hashable { }
619+
620+
621+
506622// Note that we don't yet support `indirect` for enums.
507623// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
508624/**
0 commit comments