
urldsl.vocabulary.Printer.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of url-dsl_2.12 Show documentation
Show all versions of url-dsl_2.12 Show documentation
A tiny library for parsing and creating urls in a type-safe way
The newest version!
package urldsl.vocabulary
trait Printer[T] {
def print(t: T): String
final def apply(t: T): String = print(t)
}
object Printer {
def apply[T](implicit printer: Printer[T]): Printer[T] = printer
def factory[T](printing: T => String): Printer[T] = (t: T) => printing(t)
implicit def stringPrinter: Printer[String] = factory(identity)
implicit def intPrinter: Printer[Int] = factory(_.toString)
implicit def longPrinter: Printer[Long] = factory(_.toString)
implicit def booleanPrinter: Printer[Boolean] = factory(_.toString)
implicit def doublePrinter: Printer[Double] = factory(_.toString)
implicit def bigIntPrinter: Printer[BigInt] = factory(_.toString)
implicit def floatPrinter: Printer[Float] = factory(_.toString)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy