mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
* stdlib organization & documentation improvements * fix CI * Update doc/lib.md Co-authored-by: Juan Carlos <juancarlospaco@gmail.com> * fix ci, remove jshttpcore, export in jsfetch instead * fix alphabetical order violations * add cmdline, db_odbc Co-authored-by: Juan Carlos <juancarlospaco@gmail.com>
14 lines
391 B
Nim
14 lines
391 B
Nim
## This module implements a generic `$` operator to convert objects to strings.
|
|
|
|
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)
|