std/objectdollar

Search:
Source   Edit  

This module implements a generic $ operator to convert objects to strings.

Procs

proc `$`[T: object](x: T): string
Generic $ operator for objects with similar output to $ for named tuples.

Example:

type Foo = object
  a, b: int
let x = Foo(a: 23, b: 45)
assert $x == "(a: 23, b: 45)"
Source   Edit