boltffi_bindgen 0.24.1

Code generation library for BoltFFI - generates Swift, Kotlin, and TypeScript bindings
Documentation
// <auto-generated>
// This file was generated by BoltFFI. Do not edit.
// </auto-generated>
#nullable enable

using System;

namespace {{ namespace }}
{
    public enum {{ enumeration.class_name }} : {{ enumeration.c_style_backing_type() }}
    {
{%- for variant in enumeration.variants %}
        {{ variant.name }} = {{ variant.tag }}{% if !loop.last %},{% endif %}
{%- endfor %}
    }

    internal static class {{ enumeration.class_name }}Wire
    {
        internal const int WireEncodedSize = 4;

        internal static {{ enumeration.class_name }} Decode(WireReader reader) =>
            reader.ReadI32() switch
            {
{%- for variant in enumeration.variants %}
                {{ variant.wire_tag }} => {{ enumeration.class_name }}.{{ variant.name }},
{%- endfor %}
                int tag => throw new InvalidOperationException($"Unknown {{ enumeration.class_name }} wire tag: {tag}"),
            };

        internal static void WireEncodeTo(this {{ enumeration.class_name }} value, WireWriter wire) =>
            wire.WriteI32(value switch
            {
{%- for variant in enumeration.variants %}
                {{ enumeration.class_name }}.{{ variant.name }} => {{ variant.wire_tag }},
{%- endfor %}
                _ => throw new InvalidOperationException($"Unknown {{ enumeration.class_name }} variant: {value}"),
            });
    }
{%- if enumeration.has_methods() %}

    public static class {{ enumeration.class_name }}Methods
    {
{%- for method in enumeration.methods %}
{% include "render_csharp/value_type_method.txt" %}
{%- endfor %}
    }
{%- endif %}
}