mirai-core / net.mamoe.mirai.utils / java.lang.ref.WeakReference

Extensions for java.lang.ref.WeakReference

getValue

Provides delegate value.

operator fun <T> WeakRef<T>.getValue(thisRef: Any?, property: KProperty<*>): T?

ifAbsent

Call the block if the referent is absent

fun <T, R> WeakRef<T>.ifAbsent(block: (T) -> R): R?

unsafe

Constructs an unsafe inline delegate for this

fun <T> WeakRef<T>.unsafe(): UnsafeWeakRef<T>