Skip to main content

core/WeakReference

Module that implements a weak reference to an object.

ATTENTION: This functionality does not work with classical persistence (--legacy-persistence moc flag).

Usage example: Import from the core package to use this module.

import WeakReference "mo:core/WeakReference";

Function allocate

func allocate<T>(obj : T) : WeakReference<T>

Function get

func get<T>(weakRef : WeakReference<T>) : ?T

Function isLive

func isLive<T>(weakRef : WeakReference<T>) : Bool