A fix for SSZ.saveFile

This commit is contained in:
Zahary Karadjov 2019-09-07 17:58:32 -04:00
parent e6c59d86be
commit e874ae6766
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
1 changed files with 6 additions and 2 deletions

View File

@ -107,8 +107,12 @@ template loadFile*[RecordType](Format: type,
record = loadFile(Format, filename, RecordType, params)
template saveFile*(Format: type, filename: string, args: varargs[untyped]) =
# TODO: This should use a proper output stream, instead of calling `encode`
writeFile(filename, Format.encode(args))
when false:
# TODO use faststreams output stream
discard
else:
let bytes = Format.encode(args)
writeFile(filename, cast[string](bytes))
template borrowSerialization*(Alias: distinct type,
OriginalType: distinct type) {.dirty.} =