Class

cats.effect.Resource

Allocate

Related Doc: package Resource

Permalink

final case class Allocate[F[_], A](resource: F[(A, (ExitCase[Throwable]) ⇒ F[Unit])]) extends Resource[F, A] with Product with Serializable

Resource data constructor that wraps an effect allocating a resource, along with its finalizers.

Source
Resource.scala
Linear Supertypes
Serializable, Serializable, Product, Equals, Resource[F, A], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Allocate
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. Resource
  7. AnyRef
  8. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Allocate(resource: F[(A, (ExitCase[Throwable]) ⇒ F[Unit])])

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def allocated(implicit F: Bracket[F, Throwable]): F[(A, F[Unit])]

    Permalink

    Given a Resource, possibly built by composing multiple Resources monadically, returns the acquired resource, as well as an action that runs all the finalizers for releasing it.

    Given a Resource, possibly built by composing multiple Resources monadically, returns the acquired resource, as well as an action that runs all the finalizers for releasing it.

    If the outer F fails or is interrupted, allocated guarantees that the finalizers will be called. However, if the outer F succeeds, it's up to the user to ensure the returned F[Unit] is called once A needs to be released. If the returned F[Unit] is not called, the finalizers will not be run.

    For this reason, this is an advanced and potentially unsafe api which can cause a resource leak if not used correctly, please prefer use as the standard way of running a Resource program.

    Use cases include interacting with side-effectful apis that expect separate acquire and release actions (like the before and after methods of many test frameworks), or complex library code that needs to modify or move the finalizer for an existing resource.

    Definition Classes
    Resource
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  8. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. def flatMap[B](f: (A) ⇒ Resource[F, B]): Resource[F, B]

    Permalink

    Implementation for the flatMap operation, as described via the cats.Monad type class.

    Implementation for the flatMap operation, as described via the cats.Monad type class.

    Definition Classes
    Resource
  10. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  11. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  13. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  14. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  15. val resource: F[(A, (ExitCase[Throwable]) ⇒ F[Unit])]

    Permalink
  16. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  17. def use[B](f: (A) ⇒ F[B])(implicit F: Bracket[F, Throwable]): F[B]

    Permalink

    Allocates a resource and supplies it to the given function.

    Allocates a resource and supplies it to the given function. The resource is released as soon as the resulting F[B] is completed, whether normally or as a raised error.

    f

    the function to apply to the allocated resource

    returns

    the result of applying [F] to

    Definition Classes
    Resource
  18. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from Resource[F, A]

Inherited from AnyRef

Inherited from Any

Ungrouped