Companion object providing wire factory methods and wire classes.
Attributes
- Companion
- trait
- Source
- Wire.scala
- Graph
-
- Supertypes
- Self type
-
Wire.type
Members list
Type members
Classlikes
A wire that produces a reference-counted shared instance via Resource.shared.
A wire that produces a reference-counted shared instance via Resource.shared.
The underlying instance may be shared across multiple allocating scopes. A reference count tracks usage, and the instance is released when the last referencing scope is closed. This is the default wire type produced by shared[T].
Type parameters
- In
-
the dependencies required to construct the service
- Out
-
the service type produced
Value parameters
- makeFn
-
the function that constructs the service given a finalizer and context
Attributes
- Companion
- object
- Source
- Wire.scala
- Supertypes
Companion object for Wire.Shared providing factory methods.
Companion object for Wire.Shared providing factory methods.
Attributes
- Companion
- class
- Source
- Wire.scala
- Supertypes
- Self type
-
Shared.type
A wire that produces a fresh instance each time it's used.
A wire that produces a fresh instance each time it's used.
Unlike shared wires, unique wires create new instances for each dependent service. Use for services that should not be shared, like request-scoped resources or per-call state.
Type parameters
- In
-
the dependencies required to construct the service
- Out
-
the service type produced
Value parameters
- makeFn
-
the function that constructs the service given a finalizer and context
Attributes
- Companion
- object
- Source
- Wire.scala
- Supertypes
Companion object for Wire.Unique providing factory methods.
Companion object for Wire.Unique providing factory methods.
Attributes
- Companion
- class
- Source
- Wire.scala
- Supertypes
- Self type
-
Unique.type
Inherited and Abstract types
The names of the product elements.
The name of the type.
Value members
Concrete methods
Creates a wire that injects a pre-existing value.
Creates a wire that injects a pre-existing value.
The value is wrapped in a shared wire with no dependencies. If the value is AutoCloseable, close() is registered automatically when the wire is used.
Type parameters
- T
-
the service type
Value parameters
- t
-
the value to inject
Attributes
- Returns
-
a shared wire that provides the value
- Source
- Wire.scala
Inherited methods
Derives a shared Wire for type T by inspecting its constructor.
Derives a shared Wire for type T by inspecting its constructor.
The macro inspects T's primary constructor and generates a wire that:
- Retrieves constructor parameters from the context
- Passes a
Scopeparameter if present - Registers
close()as a finalizer ifTextendsAutoCloseable
When converted to a Resource via toResource, shared wires produce a reference-counted Resource.shared so dependents receive the same instance.
Type parameters
- T
-
the service type to construct (must be a class, not a trait or abstract)
Attributes
- Returns
-
a shared wire for constructing
T - Inherited from:
- WireCompanionVersionSpecific (hidden)
- Source
- WireVersionSpecific.scala
Derives a unique Wire for type T by inspecting its constructor.
Derives a unique Wire for type T by inspecting its constructor.
Like shared[T], but the wire creates a fresh instance each time it's used. Use for services that should not be shared across dependents.
Type parameters
- T
-
the service type to construct (must be a class, not a trait or abstract)
Attributes
- Returns
-
a unique wire for constructing
T - Inherited from:
- WireCompanionVersionSpecific (hidden)
- Source
- WireVersionSpecific.scala