Skip to content

Commit 2343fdd

Browse files
committed
remove unused apply method from Castable, add codec to BaseOpaque
1 parent b6a5b95 commit 2343fdd

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

core/src/main/scala/com/avsystem/commons/opaque/BaseOpaque.scala

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@ package com.avsystem.commons
22
package opaque
33

44
import com.avsystem.commons.opaque.Castable.<:>
5+
import com.avsystem.commons.serialization.GenCodec
56

67
private[opaque] trait BaseOpaque[From] extends Castable.Ops {
78
trait Tag
89
type Type
910

10-
implicit protected final val castable: From <:> Type = new Castable[From, Type]
11-
1211
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)
1316
}

core/src/main/scala/com/avsystem/commons/opaque/Castable.scala

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package com.avsystem.commons
22
package opaque
33

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]
75
private[opaque] object Castable {
86
type <:>[A, B] = Castable[A, B]
97
def apply[A, B](implicit ev: A <:> B): Castable[A, B] = ev

0 commit comments

Comments
 (0)