Of

izumi.functional.lifecycle.Lifecycle$.Of
open class Of[+F[_], +A] extends OfInner[F, A]

Class-based proxy over a Lifecycle value

 class IntRes extends Lifecycle.Of(Lifecycle.pure(1000))

For binding resource values using class syntax in ModuleDef:

 val module = new ModuleDef {
   make[Int].fromResource[IntRes]
 }

Attributes

Note:

when the expression passed to Lifecycle.Of defines many local methods it can hit a Scalac bug https://github.com/scala/bug/issues/11969 and fail to compile, in that case you may switch to Lifecycle.OfInner

Graph
Supertypes
trait OfInner[F, A]
trait Lifecycle[F, A]
class Object
trait Matchable
class Any
Known subtypes
class FromAutoCloseable[F, A]
class OfCats[F, A]
class OfZIO[R, E, A]

Members list

Concise view

Type members

Inherited types

final override type InnerResource = InnerResource

Attributes

Inherited from:
OfInner

Value members

Constructors

def this(inner: => Lifecycle[F, A])

Inherited methods

final override def acquire: F[InnerResource]

The action in F used to acquire the resource.

The action in F used to acquire the resource.

Attributes

Note:

the acquire action is performed uninterruptibly, when F is an effect type that supports interruption/cancellation.

Definition Classes
Inherited from:
OfInner
final def beforeAcquire[G[x] : QuasiApplicative](f: => G[Unit]): Lifecycle[G, OuterResource]

Attributes

Inherited from:
Lifecycle
final def beforeRelease[G[x] : QuasiApplicative](f: InnerResource => G[Unit]): Lifecycle[G, OuterResource]

Prepend release action to existing

Prepend release action to existing

Attributes

Inherited from:
Lifecycle
final def catchAll[G[x] : QuasiIO, B >: A](recover: Throwable => Lifecycle[G, B]): Lifecycle[G, B]

Attributes

Inherited from:
Lifecycle
final def catchSome[G[x] : QuasiIO, B >: A](recover: PartialFunction[Throwable, Lifecycle[G, B]]): Lifecycle[G, B]

Attributes

Inherited from:
Lifecycle
final def evalMap[G[x] : QuasiPrimitives, B](f: A => G[B]): Lifecycle[G, B]

Attributes

Inherited from:
Lifecycle
final def evalTap[G[x] : QuasiPrimitives](f: A => G[Unit]): Lifecycle[G, OuterResource]

Attributes

Inherited from:
Lifecycle
final override def extract[B >: A](resource: InnerResource): Either[F[B], B]

Either an action in F or a pure function used to extract the OuterResource from the InnerResource

Either an action in F or a pure function used to extract the OuterResource from the InnerResource

The effect in the Left branch will be performed interruptibly, it is not afforded the same kind of safety as acquire and release actions when F is an effect type that supports interruption/cancellation.

When F is Identity, it doesn't matter whether the output is a Left or Right branch.

When consuming the output of extract you can use _.fold(identity, F.pure) to convert the Either to F[B]

Attributes

See also:

Lifecycle.Basic extract doesn't have to be defined when inheriting from Lifecycle.Basic

Definition Classes
Inherited from:
OfInner
final def flatMap[G[x] : QuasiPrimitives, B](f: A => Lifecycle[G, B]): Lifecycle[G, B]

Attributes

Inherited from:
Lifecycle
final def flatten[G[x] : QuasiPrimitives, B](implicit evidence$3: QuasiPrimitives[G], ev: A <:< Lifecycle[G, B]): Lifecycle[G, B]

Attributes

Inherited from:
Lifecycle
final def map[G[x] : QuasiFunctor, B](f: A => B): Lifecycle[G, B]

Attributes

Inherited from:
Lifecycle
final def redeem[G[x] : QuasiIO, B](onFailure: Throwable => Lifecycle[G, B], onSuccess: A => Lifecycle[G, B]): Lifecycle[G, B]

Attributes

Inherited from:
Lifecycle
final override def release(resource: InnerResource): F[Unit]

The action in F used to release, close or deallocate the resource after it has been acquired and used through izumi.distage.model.definition.Lifecycle.SyntaxUse#use.

The action in F used to release, close or deallocate the resource after it has been acquired and used through izumi.distage.model.definition.Lifecycle.SyntaxUse#use.

Attributes

Note:

the release action is performed uninterruptibly, when F is an effect type that supports interruption/cancellation.

Definition Classes
Inherited from:
OfInner
final def void[G[x] : QuasiFunctor]: Lifecycle[G, Unit]

Attributes

Inherited from:
Lifecycle
final def widen[B >: A]: Lifecycle[F, B]

Attributes

Inherited from:
Lifecycle
final def widenF[G[x]]: Lifecycle[G, OuterResource]

Attributes

Inherited from:
Lifecycle
final def wrapAcquire[G[x]](f: (=> G[InnerResource]) => G[InnerResource]): Lifecycle[G, OuterResource]

Wrap acquire action of this resource in another effect, e.g. for logging purposes

Wrap acquire action of this resource in another effect, e.g. for logging purposes

Attributes

Inherited from:
Lifecycle
final def wrapRelease[G[x]](f: (InnerResource => G[Unit], InnerResource) => G[Unit]): Lifecycle[G, OuterResource]

Wrap release action of this resource in another effect, e.g. for logging purposes

Wrap release action of this resource in another effect, e.g. for logging purposes

Attributes

Inherited from:
Lifecycle

Concrete fields

override val lifecycle: Lifecycle[F, A]