FromData
scalus.builtin.FromData
object FromData
FromData[A] derivation
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
FromData.type
Members list
Value members
Concrete methods
Derive FromData for an enum type
Derive FromData for an enum type
Value parameters
- conf
-
a partial function mapping tag to constructor function, like
Attributes
- Returns
-
a FromData instance
- Example
-
enum Adt: case A case B(b: Boolean) case C(a: Adt, b: Adt) given FromData[Adt] = FromData.deriveEnum[Adt] { case 0 => _ => Adt.A case 1 => FromData.deriveConstructor[Adt.B] case 2 => FromData.deriveConstructor[Adt.C] }
Derive FromData for an enum type
Derive FromData for an enum type
Attributes
- Returns
-
a FromData instance
- Example
-
enum Adt: case A case B(b: Boolean) case C(a: Adt, b: Adt) given FromData[Adt] = FromData.deriveEnum[Adt]
In this article