Repository navigation
Restore the whole cursor on failed read transactions; clarify docs - #17
Merged
Merged
Conversation
Only the position was restored, so a callback that replaced the cursor and then failed left it pointing into the replacement input. ReadCursor is Copy, so save and restore all of it. Fixes #16
Write transactions restore only the position, not buffer contents; say so, including that a failed at_pos can leave bytes before the original position changed. Document the error written_since returns, and correct the TrailingBytes::count description.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #16
Fix
ReadCursor::transactionrestored only the position. A callback that replaced the cursor and then returned an error left it pointing into the replacement input.ReadCursorisCopy, so it now saves and restores the whole cursor. The regression test fails without the fix.Docs
WriteCursor::transactionandat_pos: state that only the position is restored, not buffer contents. Forat_pos, a failed operation can leave bytes before the original position changed. We aren't promising to restore buffer contents, since that would need a copy of the touched region.WriteCursor::written_since: document that it returnsNumericOverflowwhenposis past the current position. The variant itself is unchanged, since changing it would break callers.TrailingBytes::count: it's the number of trailing bytes, not the number of "non-zero" trailing bytes.Found in a Codex review of 0.5.1; each finding was reproduced before fixing.