Skip to content

Commit

Permalink
Format Scala 2.13 only files
Browse files Browse the repository at this point in the history
  • Loading branch information
ruippeixotog committed Jul 7, 2020
1 parent 18c3f58 commit 26cdb4d
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions core/src/main/scala-2.13/pureconfig/FactoryCompat.scala
Expand Up @@ -4,18 +4,19 @@ import scala.collection.Factory
import scala.collection.mutable

/**
* A compatibility layer for creating `CanBuildFrom`-like generic methods that work both on Scala 2.13 and pre-2.13
* versions.
*
* @tparam A the type of elements that get added to the builder
* @tparam C the type of collection that it produces
*/
* A compatibility layer for creating `CanBuildFrom`-like generic methods that work both on Scala 2.13 and pre-2.13
* versions.
*
* @tparam A the type of elements that get added to the builder
* @tparam C the type of collection that it produces
*/
trait FactoryCompat[-A, +C] {
def newBuilder(): mutable.Builder[A, C]
}

object FactoryCompat {
implicit def fromFactory[A, C](implicit factory: Factory[A, C]): FactoryCompat[A, C] = new FactoryCompat[A, C] {
override def newBuilder() = factory.newBuilder
}
implicit def fromFactory[A, C](implicit factory: Factory[A, C]): FactoryCompat[A, C] =
new FactoryCompat[A, C] {
override def newBuilder() = factory.newBuilder
}
}

0 comments on commit 26cdb4d

Please sign in to comment.