import Foundation

enum Mem {
    static func bridge<T: AnyObject>(_ obj: T) -> UnsafeMutableRawPointer {
        Unmanaged.passUnretained(obj).toOpaque()
    }

    static func bridge<T: AnyObject>(_ ptr: UnsafeMutableRawPointer) -> T {
        Unmanaged<T>.fromOpaque(ptr).takeUnretainedValue()
    }
}
