Update readme with objprint
This commit is contained in:
parent
e96cd5abe2
commit
3186eee04e
1 changed files with 19 additions and 0 deletions
19
README.md
19
README.md
|
|
@ -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")
|
||||||
|
```
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue