Commit Graph

29 Commits

Author SHA1 Message Date
Jacek Sieka 11a8aa64d2 enable --styleCheck:usages 2021-12-07 00:33:04 +02:00
Jacek Sieka fcd0eadadd clean up imports, unittest2 2021-08-16 15:09:31 +03:00
Zahary Karadjov f9a1121b87
Make the flavors support optional when defining formats
Other changes:

* The format declarations have been broken down in multiple
  parts. This makes it possible to structure the implementation
  libraries in a way such that the format name is accessible even
  when importing only reader or writer modules.

* Flavors lead to more complicated Reader and Writer types.
  Instead of requiring the user to write down long type names
  such as `JsonReader[DefaultFlavor]`, it's now possible to refer
  to the reader and writer type of each format using expressions
  such as `Json.Reader` and `Json.Writer`.

* Fixed a typo (PreferredOutput)
2021-03-19 04:04:14 +02:00
Zahary Karadjov 84ffa54554
Add support for Format flavors 2021-03-18 12:55:50 +02:00
Zahary Karadjov a49e001f9e
A more robust helper for borrowing serialization procs 2020-06-23 22:21:49 +03:00
Zahary Karadjov 7ff764ca1f
Flush happens automatically on close 2020-05-13 11:40:04 +03:00
Zahary Karadjov 5ecae14972
Add stream.readValue 2020-05-13 11:40:04 +03:00
Zahary Karadjov dccba1e22b
Rename appendValue to writeValue for consistency 2020-05-13 11:40:04 +03:00
Zahary Karadjov d7ed9c84d3
Switch back to memory mapped files in 'loadFile' 2020-05-13 11:40:04 +03:00
Zahary Karadjov 5e8ec3485c
Use the latest FastStreams API 2020-05-13 11:40:00 +03:00
Zahary Karadjov 0476902c92
Don't raise IOError from encode and decode 2020-04-23 01:50:20 +03:00
Zahary Karadjov db037cbece
Don't rely on the filestream destructors 2020-04-22 21:26:02 +03:00
Zahary Karadjov 67bb6a77bb
Address some TODO items in loadFile and saveFile 2020-04-14 19:34:44 +03:00
Zahary Karadjov 8f6e86350e
Take advantage of some improvements in Nim 1.2 2020-04-13 16:58:25 +03:00
Zahary Karadjov 23bbf4b6a5
Use the latest FastStreams API 2020-04-09 23:13:42 +03:00
Mamy Ratsimbazafy 448a03ed4b
replace defer by try/finally to avoid 0.19.6 compiler bug (#15) 2019-09-11 14:09:58 -04:00
Mamy Ratsimbazafy 80da30b031
prevent null dereference (#13) 2019-09-11 12:41:51 -04:00
Mamy Ratsimbazafy 24474e69d1
ByteStreamVar doesn't autodereference to ByteStream, fix https://github.com/status-im/nim-beacon-chain/pull/436#issuecomment-530391076 (#12) 2019-09-11 12:16:51 -04:00
mratsim cb6055a8be autoclose streams, fix #9 2019-09-10 20:26:25 -04:00
Zahary Karadjov e874ae6766
A fix for SSZ.saveFile 2019-09-07 17:58:32 -04:00
Zahary Karadjov 060c8fd9bf
Add a helper simplifying writing a single value to a stream 2019-06-24 05:07:13 +03:00
Zahary Karadjov c13420f1d0 helper for working with distinct types 2019-03-13 23:20:27 +02:00
Zahary Karadjov 030c8e2cbe Use the latest OutputStream; Needed helpers for the SSZ support 2019-03-11 11:34:04 +02:00
Zahary Karadjov b4216704f3 pass through any reader init params in the decode/load procs 2019-01-21 19:39:18 +02:00
Zahary Karadjov 65184697ff Fix a compiler error when using T.totalSerializedFields 2018-12-28 03:01:24 +02:00
Zahary Karadjov 94224f6e18 More comprehensive APIs; Tests 2018-12-19 12:44:18 +02:00
Zahary Karadjov 89a2105376 more flexible encode API 2018-11-29 03:33:45 +02:00
Zahary Karadjov c8c8e3b7e2 Initial simple/naive implementation of the field enumeration logic 2018-11-11 13:41:04 +02:00
Zahary Karadjov cd744a5450 Very basic initial version. Covering only naively implemented writers 2018-11-10 02:14:43 +02:00