final class UnionOps[C <: Coproduct] extends AnyVal with Serializable
Discriminated union operations on Coproducts
's with field-like elements.
- Alphabetic
- By Inheritance
- UnionOps
- Serializable
- Serializable
- AnyVal
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new UnionOps(c: C)
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
##(): Int
- Definition Classes
- Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- Any
-
def
apply(k: Witness)(implicit selector: Selector[C, T]): Out
Returns the value associated with the singleton typed key k.
Returns the value associated with the singleton typed key k. Only available if this union has a field with with keyType equal to the singleton type k.T.
Note that this can creates a bogus ambiguity with
CoproductOps#apply
as described in https://issues.scala-lang.org/browse/SI-5142. If this method is accessible the conflict can be worked around by using CoproductOps#at instead ofCoproductOps#apply
. -
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- val c: C
-
def
fields(implicit fields: Fields[C]): Out
Returns a
Coproduct
made of the key-value pairs of this union. -
def
get(k: Witness)(implicit selector: Selector[C, T]): Out
Returns the value associated with the singleton typed key k.
Returns the value associated with the singleton typed key k. Only available if this union has a field with with keyType equal to the singleton type k.T.
-
def
getClass(): Class[_ <: AnyVal]
- Definition Classes
- AnyVal → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
keys(implicit keys: Keys[C]): Out
Returns the keys of this union as an
HList
of singleton typed values. -
def
mapValues(f: Poly)(implicit mapValues: MapValues[f.type, C]): Out
Maps a higher rank function across the values of this union.
-
def
toMap[K, V](implicit toMap: Aux[C, K, V]): Map[K, V]
Returns a
Map
whose keys and values are typed as the Lub of the keys and values of this union. -
def
toString(): String
- Definition Classes
- Any
-
def
union: DynamicUnionOps[C]
Returns a wrapped version of this union that provides
selectDynamic
access to fields. -
def
values(implicit values: Values[C]): Out
Returns a
Coproduct
of the values of this union.