Printer

object Printer
Companion:
class
class Object
trait Matchable
class Any
Printer.type

Value members

Concrete methods

def apply(height: Int)(partialPrint: PartialFunction[Any, String]): Printer
def apply(partialPrint: PartialFunction[Any, String]): Printer

Utiliy constructor defining a printer for some types.

Utiliy constructor defining a printer for some types.

Example use case is overriding the string repr for types which default pretty-printers do not output helpful diffs.

type ByteArray = Array[Byte]
val listPrinter = Printer.apply {
 case ll: ByteArray => ll.map(String.format("%02x", b)).mkString(" ")
}
val bytes = Array[Byte](1, 5, 8, 24)
Printers.print(bytes, listPrinter) // "01 05 08 18"

Concrete fields

val defaultHeight: Int