-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
codec: Add canonical encoding support, handle EOF (as non-error) if R…
…ead successful, and export CborStreamBreak. Canonical representation means that encoding a value will always result in the same sequence of bytes. This mostly will apply to maps. In this case, codec will do more work to encode the map keys out of band, and then sort them, before writing out the map to the stream. Canonical flag is only honored within the standard runtime-introspection (reflection-based) mode of encoding. It is ignored by codecgen (code generation). Also, if canonical flag is true, then fast-path encoding of maps is skipped. There is a slight performance hit if Canonical flag is on, as we have to encode the keys out-of-band, and then sort them, before encoding the whole map. Canonical mode is turned on via a flag in EncodeOptions (handler). Also, export CborStreamBreak as a convenience and for symmetry (as other stream constants were exported). Also, handle EOF if Read was successful. If a successful Read happened, but an EOF was returned at same time, we do not treat that as an error. Fixes #56 Fixes #58 Fixes #59
- Loading branch information
Showing
11 changed files
with
1,404 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.