File tree 2 files changed +6
-5
lines changed
core/src/main/scala/com/avsystem/commons/opaque
2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -2,12 +2,15 @@ package com.avsystem.commons
2
2
package opaque
3
3
4
4
import com .avsystem .commons .opaque .Castable .<:>
5
+ import com .avsystem .commons .serialization .GenCodec
5
6
6
7
private [opaque] trait BaseOpaque [From ] extends Castable .Ops {
7
8
trait Tag
8
9
type Type
9
10
10
- implicit protected final val castable : From <:> Type = new Castable [From , Type ]
11
-
12
11
def apply (value : From ): Type
12
+
13
+
14
+ implicit protected final val castable : From <:> Type = new Castable [From , Type ]
15
+ implicit final def codec (implicit fromCodec : GenCodec [From ]): GenCodec [Type ] = wrapF(fromCodec)
13
16
}
Original file line number Diff line number Diff line change 1
1
package com .avsystem .commons
2
2
package opaque
3
3
4
- private [opaque] final class Castable [A , B ] {
5
- @ inline def apply (a : A ): B = a.asInstanceOf [B ]
6
- }
4
+ private [opaque] final class Castable [A , B ]
7
5
private [opaque] object Castable {
8
6
type <:> [A , B ] = Castable [A , B ]
9
7
def apply [A , B ](implicit ev : A <:> B ): Castable [A , B ] = ev
You can’t perform that action at this time.
0 commit comments