• Effekt Logo Effekt Library
    • ref
      • Ref
      • allocate
      • ref
      • get
      • set
    • ref
    • Jump to source: libraries/common/ref.effekt
      Example usage: examples/stdlib/ref
      • Ref [T]
      • Global, mutable references
      • allocate [T]: Ref[T] / {}
      • Allocates a new reference, keeping its value _undefined_.
        Prefer using `ref` constructor instead to ensure that the value is defined.
      • ref [T] (init: T): Ref[T] / {}
      • Creates a new reference with the initial value `init`.
      • get [T] (ref: Ref[T]): T / {}
      • Gets the referenced element of the `ref` in constant time.
      • set [T] (ref: Ref[T], value: T): Unit / {}
      • Sets the referenced element of the `ref` to `value` in constant time.