alef 0.25.37

Opinionated polyglot binding generator for Rust libraries
Documentation
// Auto-generated by alef — DO NOT EDIT
#nullable enable

namespace {{ namespace }} {

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;

/// <summary>
/// Service wrapper for {{ service_name }}.
/// </summary>
public class {{ class_name }} {

    private IntPtr _handle;
    private static readonly Dictionary<IntPtr, GCHandle> _registeredCallbacks = new();
    // A single static delegate instance bridges the native callback. Held in a static field so the
    // marshalled function pointer outlives every registration (a transient delegate would be collected).
    private static readonly NativeMethods.HandlerCallback _handlerCallback = HandlerTrampoline;