Update readme with objprint

This commit is contained in:
Joey 2020-09-16 10:10:32 -06:00 • committed by GitHub
commit 3186eee04e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -53,3 +53,22 @@ Extensions so far include:
echo i, " ", tup echo i, " ", tup
``` ```
## Objprint
These printing procs are useful for printing objects and their types.
```nim
import objprint
type Unit = ref object
name: string
echo Unit(name: "Ref")
echo Unit(name: "Non-ref")[]
echo (str: "value")
# Prints:
#. ref Unit(name: "Ref")
#. Unit(name: "Non-ref")
#. tuple[str: string](str: "value")
```