Packages

sealed abstract class ZScope[+A] extends AnyRef

A ZScope[A] is a value that allows adding finalizers identified by a key. Scopes are closed with a value of type A, which is provided to all the finalizers when the scope is released.

For safety reasons, this interface has no method to close a scope. Rather, an open scope may be required with ZScope.make, which returns a function that can close a scope. This allows scopes to be safely passed around without fear they will be accidentally closed.

Self Type
ZScope[A]
Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ZScope
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def ensure(finalizer: (A) => UIO[Any], mode: Mode = ZScope.Mode.Strong)(implicit trace: ZTraceElement): UIO[Either[A, Key]]

    Adds a finalizer to the scope.

    Adds a finalizer to the scope. If successful, this ensures that when the scope exits, the finalizer will be run, assuming the key has not been garbage collected.

    The returned effect will succeed with Right with a key if the finalizer was added to the scope or Left with the value the scope was closed with if the scope is already closed.

  2. abstract def isClosed(implicit trace: ZTraceElement): UIO[Boolean]

    Determines if the scope is closed at the instant the effect executes.

    Determines if the scope is closed at the instant the effect executes. Returns an effect that will succeed with true if the scope is closed, and false otherwise.

  3. abstract def isEmpty(implicit trace: ZTraceElement): UIO[Boolean]

    Determines if the scope is empty (has no finalizers) at the instant the effect executes.

    Determines if the scope is empty (has no finalizers) at the instant the effect executes. The returned effect will succeed with true if the scope is empty, and false otherwise.

  4. abstract def isReleased(implicit trace: ZTraceElement): UIO[Boolean]

    Determines if the scope has been released at the moment the effect is executed executed.

    Determines if the scope has been released at the moment the effect is executed executed. A scope can be closed yet unreleased, if it has been extended by another scope which is not yet released.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  6. def deny(key: => Key)(implicit trace: ZTraceElement): UIO[Boolean]

    Prevents a previously added finalizer from being executed when the scope is closed.

    Prevents a previously added finalizer from being executed when the scope is closed. The returned effect will succeed with true if the finalizer will not be run by this scope, and false otherwise.

  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  9. final def extend(that: ZScope[Any])(implicit trace: ZTraceElement): UIO[Boolean]

    Extends the specified scope so that it will not be closed until this scope is closed.

    Extends the specified scope so that it will not be closed until this scope is closed. Note that extending a scope into the global scope will result in the scope *never* being closed!

    Scope extension does not result in changes to the scope contract: open scopes must *always* be closed.

  10. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  11. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  12. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. def isOpen(implicit trace: ZTraceElement): UIO[Boolean]

    Determines if the scope is open at the moment the effect is executed.

    Determines if the scope is open at the moment the effect is executed. Returns an effect that will succeed with true if the scope is open, and false otherwise.

  15. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  17. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  18. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  19. def toString(): String
    Definition Classes
    AnyRef → Any
  20. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  21. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  22. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped