Renderable

com.phasmidsoftware.lascala.Renderable
See theRenderable companion trait
object Renderable

Attributes

Companion
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Renderable.type

Members list

Value members

Concrete methods

def apply[A](using r: Renderable[A]): Renderable[A]
inline def derived[T](using m: Of[T]): Renderable[T]

Method to derive a Renderable for a case class (or case object), sealed trait or enum. A case class is rendered with one line per field, for example:

Method to derive a Renderable for a case class (or case object), sealed trait or enum. A case class is rendered with one line per field, for example:

Player(
 name:"Robin",
 rating:1850.5
)

Attributes

Method to create a Renderable[A] that uses toString. This is never used automatically: a type with no Renderable instance does not compile.

Method to create a Renderable[A] that uses toString. This is never used automatically: a type with no Renderable instance does not compile.

Type parameters

A

the underlying type

Attributes

Returns

a Renderable[A]

def renderElements(ws: Seq[String], indent: Int)(using layout: Layout): String

Method to lay out elements which have already been rendered (each at indent + 1). If there are at least two elements, each starts on a new line; otherwise, they are all on one line.

Method to lay out elements which have already been rendered (each at indent + 1). If there are at least two elements, each starts on a new line; otherwise, they are all on one line.

Value parameters

indent

the indent of the collection

ws

the rendered elements

Attributes

Returns

the elements with bookends and separators, and a note of any elements beyond layout.maxElements

Givens

Givens

given bigDecimalRenderable: Renderable[BigDecimal]
given bigIntRenderable: Renderable[BigInt]
given booleanRenderable: Renderable[Boolean]
given charRenderable: Renderable[Char]
given doubleRenderable: Renderable[Double]
given eitherRenderable: [L, R] => (Renderable[L], Renderable[R]) => Renderable[Either[L, R]]
given floatRenderable: Renderable[Float]
given iterableRenderable: [A, CC <: (Iterable)] => Renderable[A] => Renderable[CC[A]]

One instance for every collection (List, Vector, Seq, Set, LazyList, etc.).

One instance for every collection (List, Vector, Seq, Set, LazyList, etc.).

Attributes

given longRenderable: Renderable[Long]
given mapRenderable: [K, V] => (Renderable[K], Renderable[V]) => Renderable[Map[K, V]]

A Map is rendered as a collection of key->value entries.

A Map is rendered as a collection of key->value entries.

Attributes

given optionRenderable: [A] => Renderable[A] => Renderable[Option[A]]
given stringRenderable: Renderable[String]

Strings are quoted, so that they can be distinguished within a structure.

Strings are quoted, so that they can be distinguished within a structure.

Attributes

given tryRenderable: [A] => Renderable[A] => Renderable[Try[A]]
inline given tupleRenderable: [T <: Tuple] => Renderable[T]

Tuples are rendered on one line, for example Tuple2("x","y").

Tuples are rendered on one line, for example Tuple2("x","y").

Attributes

given unitRenderable: Renderable[Unit]