alef 0.62.8

Opinionated polyglot binding generator for Rust libraries
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class {{ class_name }} internal constructor(handle: Long) : AutoCloseable {
    private var nativeHandle: Long = handle
    internal val handle: Long
        @Synchronized get() {
            check(nativeHandle != 0L) { "{{ class_name }} is closed" }
            return nativeHandle
        }

    @Synchronized
    override fun close() {
        val ownedHandle = nativeHandle
        if (ownedHandle == 0L) return
        nativeHandle = 0L
        {{ bridge_name }}.{{ free_name }}(ownedHandle)
    }