---
source: boltffi_bindgen/src/render/swift/templates.rs
assertion_line: 706
expression: "render_enum(&e, \"\")"
---
/// A cardinal compass direction.
public enum Direction: Int32, Hashable, Sendable, CaseIterable {
    /// Pointing toward the north pole.
    case north = 0
    case south = 1

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

}

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