Add a low-level API for controlling the state of the Writer when writing to the output stream manually

This commit is contained in:
Zahary Karadjov 2020-11-27 19:42:33 +02:00
parent 32f75d93b0
commit cedf0c5f0c
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609

View File

@ -70,6 +70,9 @@ proc writeField*(w: var JsonWriter, name: string, value: auto) =
w.state = AfterField
template fieldWritten*(w: var JsonWriter) =
w.state = AfterField
proc beginRecord*(w: var JsonWriter) =
doAssert w.state == RecordExpected