boltffi_bindgen 0.2.0

Code generation library for BoltFFI - generates Swift, Kotlin, and TypeScript bindings
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{{ self::swift_doc_block(doc, "") }}public enum {{ class_name }}: {{ self::swift_c_style_enum_raw_type(tag_type) }}, Hashable, Sendable, CaseIterable{% if is_error %}, Error{% endif %} {
{%- for variant in variants %}
{{ self::swift_doc_block(variant.doc, "    ") }}    case {{ variant.swift_name }} = {{ variant.discriminant }}
{%- endfor %}

    @usableFromInline init(fromC c: {{ self::swift_c_style_enum_raw_type(tag_type) }}) { self = {{ class_name }}(rawValue: c)! }
    @usableFromInline var cValue: {{ self::swift_c_style_enum_raw_type(tag_type) }} { rawValue }

}

extension {{ class_name }}: WireCodable {
    @inlinable static func decode(from reader: inout WireReader) -> {{ class_name }} { {{ class_name }}(rawValue: {{ self::swift_c_style_enum_decode_expr(tag_type) }})! }
    @inlinable func encode(to writer: inout WireWriter) { {{ self::swift_c_style_enum_encode_stmt(tag_type) }} }
}