Mirror

scala.deriving.Mirror
See theMirror companion trait
object Mirror

Attributes

Companion
trait
Source
Mirror.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Mirror.type

Members list

Type members

Classlikes

trait Product extends Mirror

The Mirror for a product type.

The Mirror for a product type.

Attributes

Source
Mirror.scala
Supertypes
trait Mirror
class Object
trait Matchable
class Any
Known subtypes
Self type
trait Singleton extends Product

Attributes

Source
Mirror.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
class SingletonProxy(val value: AnyRef) extends Product

A proxy for Scala 2 singletons, which do not inherit Singleton directly.

A proxy for Scala 2 singletons, which do not inherit Singleton directly.

Value parameters

value

the Scala 2 singleton instance being proxied

Attributes

Source
Mirror.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
trait Sum extends Mirror

The Mirror for a sum type.

The Mirror for a sum type.

Attributes

Source
Mirror.scala
Supertypes
trait Mirror
class Object
trait Matchable
class Any
Self type
Sum

Types

type Of[T] = Mirror { type MirroredType = T; type MirroredMonoType = T; type MirroredElemTypes <: Tuple; }

Attributes

Source
Mirror.scala
type ProductOf[T] = Product { type MirroredType = T; type MirroredMonoType = T; type MirroredElemTypes <: Tuple; }

Attributes

Source
Mirror.scala
type SumOf[T] = Sum { type MirroredType = T; type MirroredMonoType = T; type MirroredElemTypes <: Tuple; }

Attributes

Source
Mirror.scala

Extensions

Extensions

extension [T](p: ProductOf[T])
def fromProductTyped[A <: Product, Elems <: p.MirroredElemTypes](a: A)(using ProductOf[A] { type MirroredElemTypes = Elems; }): T

Creates a new instance of type T with elements taken from product a.

Creates a new instance of type T with elements taken from product a.

Type parameters

A

the product type whose elements are used as input

Elems

the tuple type representing A's elements, constrained to be a subtype of T's MirroredElemTypes

Value parameters

a

the product instance whose elements are copied into the new T

Attributes

Source
Mirror.scala
def fromTuple(t: p.MirroredElemTypes): T

Creates a new instance of type T with elements taken from tuple t.

Creates a new instance of type T with elements taken from tuple t.

Value parameters

t

the tuple containing the elements for the new T instance

Attributes

Source
Mirror.scala