alef 0.62.6

Opinionated polyglot binding generator for Rust libraries
Documentation
1
2
3
4
5
6
7
8
9
@Suppress("TooManyFunctions")
class {{ class_name }} internal constructor(handle: Long) : AutoCloseable {
    private val handleLock = Any()
    private var nativeHandle: Long = handle

    private inline fun <T> withHandle(block: (Long) -> T): T = synchronized(handleLock) {
        check(nativeHandle != 0L) { "{{ class_name }} is closed" }
        block(nativeHandle)
    }