sealed abstract class ZServiceBuilder[-RIn, +E, +ROut] extends AnyRef
A ZServiceBuilder[E, A, B] describes how to build one or more services in
your application. Services can be injected into effects via ZIO#inject.
Effects can require services via ZIO.service."
ServiceBuilder can be thought of as recipes for producing bundles of services, given their dependencies (other services).
Construction of services can be effectful and utilize resources that must be acquired and safely released when the services are done being utilized.
By default service builders are shared, meaning that if the same servicebuilder is used twice the service builder will only be allocated a single time.
Because of their excellent composition properties, service builders are the idiomatic way in ZIO to create services that depend on other services.
- Self Type
- ZServiceBuilder[RIn, E, ROut]
- Alphabetic
- By Inheritance
- ZServiceBuilder
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !(implicit ev1: <:<[E, Throwable], ev2: CanFail[E], trace: ZTraceElement): ZServiceBuilder[RIn, Nothing, ROut]
A symbolic alias for
orDie. - final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def +!+[E1 >: E, RIn2, ROut1 >: ROut, ROut2](that: ZServiceBuilder[RIn2, E1, ROut2])(implicit ev: UnionAll[ROut1, ROut2]): ZServiceBuilder[RIn with RIn2, E1, ROut1 with ROut2]
- final def ++[E1 >: E, RIn2, ROut1 >: ROut, ROut2](that: ZServiceBuilder[RIn2, E1, ROut2])(implicit ev: Union[ROut1, ROut2], tag: zio.Tag[ROut2]): ZServiceBuilder[RIn with RIn2, E1, ROut1 with ROut2]
Combines this service builder with the specified service builder, producing a new service builder that has the inputs and outputs of = both.
- final def <&>[E1 >: E, RIn2, ROut2](that: ZServiceBuilder[RIn2, E1, ROut2]): ZServiceBuilder[RIn with RIn2, E1, (ROut, ROut2)]
A symbolic alias for
zipPar. - def <>[RIn1 <: RIn, E1, ROut1 >: ROut](that: ZServiceBuilder[RIn1, E1, ROut1])(implicit ev: CanFail[E], trace: ZTraceElement): ZServiceBuilder[RIn1, E1, ROut1]
A symbolic alias for
orElse. - final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def >+>[E1 >: E, RIn2 >: ROut, ROut1 >: ROut, ROut2](that: ZServiceBuilder[RIn2, E1, ROut2])(implicit ev: Union[ROut1, ROut2], tagged: zio.Tag[ROut2], trace: ZTraceElement): ZServiceBuilder[RIn, E1, ROut1 with ROut2]
Feeds the output services of this service builder into the input of the specified service builder, resulting in a new service builder with the inputs of this service builder, and the outputs of both service builders.
- final def >>>[E1 >: E, ROut2](that: ZServiceBuilder[ROut, E1, ROut2])(implicit trace: ZTraceElement): ZServiceBuilder[RIn, E1, ROut2]
Feeds the output services of this service builder into the input of the specified service builder, resulting in a new service builder with the inputs of this service builder, and the outputs of the specified service builder.
- final def and[E1 >: E, RIn2, ROut1 >: ROut, ROut2](that: ZServiceBuilder[RIn2, E1, ROut2])(implicit ev: Union[ROut1, ROut2], tagged: zio.Tag[ROut2]): ZServiceBuilder[RIn with RIn2, E1, ROut1 with ROut2]
A named alias for
++. - final def andTo[E1 >: E, RIn2 >: ROut, ROut1 >: ROut, ROut2](that: ZServiceBuilder[RIn2, E1, ROut2])(implicit ev: Union[ROut1, ROut2], tagged: zio.Tag[ROut2], trace: ZTraceElement): ZServiceBuilder[RIn, E1, ROut1 with ROut2]
A named alias for
>+>. - final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- final def build(implicit trace: ZTraceElement): ZManaged[RIn, E, ROut]
Builds a service builder into a managed value.
- final def catchAll[RIn1 <: RIn, E1, ROut1 >: ROut](handler: ZServiceBuilder[(RIn1, E), E1, ROut1])(implicit trace: ZTraceElement): ZServiceBuilder[RIn1, E1, ROut1]
Recovers from all errors.
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def flatMap[RIn1 <: RIn, E1 >: E, ROut2](f: (ROut) => ZServiceBuilder[RIn1, E1, ROut2])(implicit trace: ZTraceElement): ZServiceBuilder[RIn1, E1, ROut2]
Constructs a service builder dynamically based on the output of this service builder.
- final def flatten[RIn1 <: RIn, E1 >: E, ROut2](implicit ev: <:<[ROut, ZServiceBuilder[RIn1, E1, ROut2]], trace: ZTraceElement): ZServiceBuilder[RIn1, E1, ROut2]
This method can be used to "flatten" nested service builders.
- final def fold[E1, RIn1 <: RIn, ROut2](failure: ZServiceBuilder[(RIn1, Cause[E]), E1, ROut2], success: ZServiceBuilder[ROut, E1, ROut2])(implicit ev: CanFail[E]): ZServiceBuilder[RIn1, E1, ROut2]
Feeds the error or output services of this service builder into the input of either the specified
failureorsuccessservice builders, resulting in a new service builder with the inputs of this service builder, and the error or outputs of the specified service builder. - final def fresh: ZServiceBuilder[RIn, E, ROut]
Creates a fresh version of this service builder that will not be shared.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final lazy val hashCode: Int
Returns the hash code of this service builder.
Returns the hash code of this service builder.
- Definition Classes
- ZServiceBuilder → AnyRef → Any
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def launch(implicit trace: ZTraceElement): ZIO[RIn, E, Nothing]
Builds this service builder and uses it until it is interrupted.
Builds this service builder and uses it until it is interrupted. This is useful when your entire application is a service builder, such as an HTTP server.
- final def map[ROut1](f: (ROut) => ROut1)(implicit trace: ZTraceElement): ZServiceBuilder[RIn, E, ROut1]
Returns a new service builder whose output is mapped by the specified function.
- final def mapError[E1](f: (E) => E1)(implicit ev: CanFail[E], trace: ZTraceElement): ZServiceBuilder[RIn, E1, ROut]
Returns a service builder with its error channel mapped using the specified function.
- final def memoize(implicit trace: ZTraceElement): ZManaged[Any, Nothing, ZServiceBuilder[RIn, E, ROut]]
Returns a managed effect that, if evaluated, will return the lazily computed result of this service builder.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def orDie(implicit ev1: IsSubtypeOfError[E, Throwable], ev2: CanFail[E], trace: ZTraceElement): ZServiceBuilder[RIn, Nothing, ROut]
Translates effect failure into death of the fiber, making all failures unchecked and not a part of the type of the service builder.
- final def orElse[RIn1 <: RIn, E1, ROut1 >: ROut](that: ZServiceBuilder[RIn1, E1, ROut1])(implicit ev: CanFail[E], trace: ZTraceElement): ZServiceBuilder[RIn1, E1, ROut1]
Executes this service builder and returns its output, if it succeeds, but otherwise executes the specified service builder.
- final def retry[RIn1 <: RIn with Has[Clock]](schedule: Schedule[RIn1, E, Any])(implicit trace: ZTraceElement): ZServiceBuilder[RIn1, E, ROut]
Retries constructing this service builder according to the specified schedule.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- final def tap[RIn1 <: RIn, E1 >: E](f: (ROut) => ZIO[RIn1, E1, Any])(implicit trace: ZTraceElement): ZServiceBuilder[RIn1, E1, ROut]
Performs the specified effect if this service builder succeeds.
- final def tapError[RIn1 <: RIn, E1 >: E](f: (E) => ZIO[RIn1, E1, Any])(implicit trace: ZTraceElement): ZServiceBuilder[RIn1, E1, ROut]
Performs the specified effect if this service builder fails.
- final def to[E1 >: E, ROut2](that: ZServiceBuilder[ROut, E1, ROut2])(implicit trace: ZTraceElement): ZServiceBuilder[RIn, E1, ROut2]
A named alias for
>>>. - final def toRuntime(runtimeConfig: RuntimeConfig)(implicit ev: <:<[Any, RIn], trace: ZTraceElement): Managed[E, Runtime[ROut]]
Converts a service builder that requires no services into a managed runtime, which can be used to execute effects.
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def update[A](f: (A) => A)(implicit arg0: zio.Tag[A], ev1: IsHas[ROut], ev2: <:<[ROut, Has[A]], trace: ZTraceElement): ZServiceBuilder[RIn, E, ROut]
Updates one of the services output by this service builder.
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def zipPar[E1 >: E, RIn2, ROut2](that: ZServiceBuilder[RIn2, E1, ROut2]): ZServiceBuilder[RIn with RIn2, E1, (ROut, ROut2)]
Combines this service builder the specified service builder, producing a new service builder that has the inputs of both, and the outputs of both combined into a tuple.
- final def zipWithPar[E1 >: E, RIn2, ROut1 >: ROut, ROut2, ROut3](that: ZServiceBuilder[RIn2, E1, ROut2])(f: (ROut, ROut2) => ROut3): ZServiceBuilder[RIn with RIn2, E1, ROut3]
Combines this service builder the specified service builder, producing a new service builder that has the inputs of both, and the outputs of both combined using the specified function.