summary refs log tree commit diff stats
path: root/lib/std/objectdollar.nim
blob: f413bbc46637f96df5ef2ed661b2b380cdca92eb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
import std/private/miscdollars

proc `$`*[T: object](x: T): string =
  ## Generic `$` operator for objects with similar output to
  ## `$` for named tuples.
  runnableExamples:
    type Foo = object
      a, b: int
    let x = Foo(a: 23, b: 45)
    assert $x == "(a: 23, b: 45)"
  tupleObjectDollar(result, x)