forked from jam1garner/binrw
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement usage tracking in codegen for
stream_position
calls
This should increase the accuracy of positioning information in errors and ensures `stream_position` calls will only be emitted when the result may actually be used. There are still too many `stream_position` calls in part because there is no API to coordinate between parent and child objects to prevent children from doing their own position management when the parent is already doing it. Improving this will probably require some kind of rudimentary stack tracking, or at least to split the API so that `read_options` is an entrypoint and then there is e.g. `read_inner` that does not try to restore position on error. In future, it should be possible for authors to configure trading off worse error handling with performance by e.g. making error position `Option<u64>` and emitting `None`s instead of a variable reference, and giving some option to not leave the stream in a known good state on failure. Refs jam1garner#220.
- Loading branch information
Showing
11 changed files
with
329 additions
and
141 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
Oops, something went wrong.