---
source: boltffi_bindgen/src/render/swift/templates.rs
assertion_line: 802
expression: "render_enum(&e, \"\")"
---
public enum ApiError: Int32, Hashable, Sendable, CaseIterable, Error {
    case notFound = 0
    case unauthorized = 1
    case serverError = 2

    @usableFromInline init(fromC c: Int32) { self = ApiError(rawValue: c)! }
    @usableFromInline var cValue: Int32 { rawValue }
    @usableFromInline init(wireTag: Int32) {
        switch wireTag {
        case 0: self = .notFound
        case 1: self = .unauthorized
        case 2: self = .serverError
        default: fatalError("Invalid ApiError wire tag: \(wireTag)")
        }
    }
    @usableFromInline var wireTag: Int32 {
        switch rawValue {
        case 0: return 0
        case 1: return 1
        case 2: return 2
        default: fatalError("Invalid ApiError raw value: \(rawValue)")
        }
    }

}

extension ApiError: WireCodable {
    @inlinable static func decode(from reader: inout WireReader) -> ApiError { ApiError(wireTag: reader.readI32()) }
    @inlinable func encode(to writer: inout WireWriter) { writer.writeI32(wireTag) }
}
