aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
diff options
context:
space:
mode:
authorJonathan Marler <johnnymarler@gmail.com>2022-06-30 15:02:09 -0600
committerVeikka Tuominen <git@vexu.eu>2022-07-24 11:51:59 +0300
commitf598234ee820ca0d57946542a852f193b21d847f (patch)
tree5ab1dda8719c06cd4b52e2b7ce7c8f0c4b8f417a /src/codegen
parenta2ab9e36faded9755ecc1fe809c49140120c3c61 (diff)
downloadzig-f598234ee820ca0d57946542a852f193b21d847f.tar.gz
zig-f598234ee820ca0d57946542a852f193b21d847f.zip
std.json: expose encodeJsonString and encodeJsonStringChars
Expose 2 functions from std.json. These functions take a slice of bytes and forward them to a given writer as a JSON encoded string. The use case I have for this is in a custom JsonStringWriter. This writer takes data and automatically encodes it as JSON string characters and forwards it to an underlying writer. I use this JsonStringWriter in combination with std.fmt.format to go directly from a format string/arg pair to JSON. This way I don't have to format my string into a separate buffer first and encode it afterwards, which avoids the need to create a temporary buffer to hold the unencoded but formatted string.
Diffstat (limited to 'src/codegen')
0 files changed, 0 insertions, 0 deletions