class GcHandle
pub class GcHandle<T>
An object of a class held for C: the collector keeps it while the handle does, and
GcHandle.asPtr is the void * C keeps and hands back — the userdata of a C API that holds
a Lyric object across its calls.
A handle made again from that pointer, with GcHandle.from, reads the same object; one GcHandle.release lets it go, after which no handle of it is read again.
Methods
pub static fn pin(object: T): GcHandle<T>
Returns a handle that holds object until GcHandle.release.
pub static fn from(pointer: Ptr<void>): GcHandle<T>
Returns the handle a pointer GcHandle.asPtr gave stands for. Unsafe: the pointer must be a handle's that is not released.
Panics
Where it holds an object of another class than T — when it is read.
pub fn get(): T
Returns the object it holds.
Panics
Where this handle was released.
pub fn asPtr(): Ptr<void>
Returns the pointer C keeps for it: the same for every handle of the object.
pub mut fn release(): void
Lets the object go: the collector may take it once nothing else holds it.
Panics
Where this handle was released already.