84 Commits

Author SHA1 Message Date
Etan Kissling
d856d6ece5
Update readme for current API
The README file was describing an outdated way of defining serialization
formats. It was updated accordingly to match the current API.

- New format declaration using `setReader` and `setWriter`
  and mandatory `PreferredOutput` type declaration,
  as introduced in f9a1121b8733eb75e624ab59f8d79e707f15f76f.
- Removal of `fileExt` declaration, which was never implemented.
- Removal of format-specific `dontSerialize` pragma
  as well as the `serialize` pragma, which were never implemented.
- Rename `serializedFields` macro to `setSerializedFields`,
  to keep up with 60613bac5db2bd7914d484874201f31b3f318165.
- Remove rename functionality in `setSerializedFields`,
  which was never implemented.
- A couple updated argument lists and typo corrections.
2022-06-19 15:18:41 +07:00
narimiran
971a76e86d move -d:nimRawSetjmp to nim.cfg
Refs https://github.com/status-im/nimbus-build-system/issues/44
2022-06-19 14:59:20 +07:00
Zahary Karadjov
7d64c0d843
FieldTag no longer requires specifying the FieldType 2022-06-18 13:29:32 +03:00
Zahary Karadjov
9631fbd1c8
Better default behavior for SerializationError.formatMsg 2022-03-09 17:15:50 +02:00
Ștefan Talpalaru
37bc0db558
CI: test with multiple Nim versions (#39) 2022-01-06 19:36:22 +01:00
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
Ștefan Talpalaru
5213d397f9
CI: refactor Nim compiler caching (#35) 2021-06-03 01:59:50 +02: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
261de741b7
Revert "Handle record types with when statements"
This reverts commit dfd6e349a62417b7951f17a0afea89a0c11d5ebc.
2021-02-18 23:08:21 +02:00
Zahary Karadjov
32fce5df8d
Revert "Support when statements in records that reuse the same field name in different branches"
This reverts commit 4e2ffe3f6df5b753d7b11fef83cc5ee14f296c1c.
2021-02-18 23:07:52 +02:00
Jacek Sieka
293a987c51 work around broken gc during global init 2021-02-18 22:31:23 +02:00
Zahary Karadjov
4e2ffe3f6d
Support when statements in records that reuse the same field name in different branches 2021-01-06 15:27:28 +02:00
andri lim
217d78a1dc
Merge pull request #31 from status-im/github_action
add github action
2020-12-26 11:35:17 +07:00
jangko
dd115dca5b
add github action 2020-12-24 11:34:38 +07:00
Zahary Karadjov
dfd6e349a6
Handle record types with when statements 2020-12-22 20:24:54 +02:00
jangko
474bdbf49c silence declared but not used warning 2020-08-05 10:08:27 +03:00
Zahary Karadjov
5b11c41731
Handle updates in nim-stew 2020-07-08 00:31:20 +03:00
Zahary Karadjov
e0e51015b7
Handle pragma-annotated field names; Fix #28 2020-06-24 14:08:56 +03:00
Zahary Karadjov
a49e001f9e
A more robust helper for borrowing serialization procs 2020-06-23 22:21:49 +03:00
Zahary Karadjov
5498b62dbd
Stricter error handling 2020-06-16 00:59:35 +03:00
Zahary Karadjov
d8ca3daf3a
raises annotations for some generated procs 2020-05-30 22:37:23 +03:00
Zahary Karadjov
501f94ad61
Allow checking if the serialization tracing is enabled 2020-05-29 21:32:44 +03:00
Zahary Karadjov
16e6bcd16d
More tests with derived types 2020-05-27 11:33:02 +03:00
Zahary Karadjov
2baaccd50e
Add roundtrip tests using inheritance 2020-05-26 19:38:03 +03:00
Zahary Karadjov
8a25451fce
Add an easier way to enable the serializaton tracing 2020-05-22 15:20:24 +03:00
Zahary Karadjov
8a013591bd
Add a pragma for customizing the field names in formats such as Json 2020-05-20 13:48:14 +03:00
Zahary Karadjov
b61fcb51ad
Work-around a scary issue affecting the SSZ serialization 2020-05-19 13:42:56 +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
Alexander Ivanov
f310607d04 Test for non-string keys of table 2020-05-08 16:57:33 +03:00
Jacek Sieka
9f085c33a9
nim 1.2 2020-04-24 08:56:54 +02:00
Zahary Karadjov
1989a55145
Remove a warning triggered by not nil types 2020-04-23 01:50:25 +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
Zahary Karadjov
68e9ef7901 More comprehensive test suite; Depends on Fixes in Nim 1.2 2020-04-09 19:25:07 +03:00
Zahary Karadjov
0eab8cfeee
nimble test will now test with threading enabled/disabled 2020-03-24 16:34:38 +02:00
Zahary Karadjov
ae60eef4e8
Reduce warnings in Nim 1.0.2; Fix #16 2019-11-04 18:55:12 +00: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
Mamy Ratsimbazafy
7a42cab625
Merge pull request #10 from status-im/autoclose-streams
autoclose streams, fix #9
2019-09-10 22:25:24 -04:00
mratsim
cb6055a8be autoclose streams, fix #9 2019-09-10 20:26:25 -04:00