Locker

final class Locker

Locker - A persistent store for a single value. This utilizes the fact that a unique is linked to a type. Since the key is linked to a type, then we can cast the value to Any, and join it to the Unique. Then if we are then asked to unlock this locker with the same unique, we know that the type MUST be the type of the Key, so we can bring it back as that type safely.

Locker - A persistent store for a single value. This utilizes the fact that a unique is linked to a type. Since the key is linked to a type, then we can cast the value to Any, and join it to the Unique. Then if we are then asked to unlock this locker with the same unique, we know that the type MUST be the type of the Key, so we can bring it back as that type safely.

Companion
object
class Object
trait Matchable
class Any

Value members

Concrete methods

def unlock[A](k: Key[A]): Option[A]

Retrieve the value from the Locker. If the reference equality instance backed by a Unique value is the same then allows conversion to that type, otherwise as it does not match then this will be None

Retrieve the value from the Locker. If the reference equality instance backed by a Unique value is the same then allows conversion to that type, otherwise as it does not match then this will be None

Value Params
k

The key to check, if the internal Unique value matches then this Locker can be unlocked as the specifed value