2 ms·
How do you define a trait that is itself generic? Like: trait ConvertTo[T]: fun convert(self) -> T; Seems to create a single trait ConvertTo, for a
by wavemode 2mo ago
How do you define a trait that is itself generic? Like:
trait ConvertTo[T]:
fun convert(self) -> T;
Seems to create a single trait ConvertTo, for a generic type with a [T] argument, rather than allowing one to define separate implementations for ConvertTo[i32], ConvertTo[String], etc.