Uh oh!
There was an error while loading. Please reload this page.
Make exp_any return the earliest result - #64
Merged
bors[bot] merged 1 commit intoSep 12, 2022
Conversation
ekarlsn
commented
Sep 12, 2022
CollaboratorAuthor
Is the only way to edit this commit-message to close the PR and open a new one? |
matthiasbeyer
commented
Sep 12, 2022
Member
No, you can |
matthiasbeyer
requested changes
Sep 12, 2022
Uh oh!
There was an error while loading. Please reload this page.
ekarlsnforce-pushed
the
origin/any-returns-earliest-result
branch
from
September 12, 2022 08:50
ce74614 to
834a9aaComparePreviously,
exp_any would return the match with the lowest index in the list.
So this:
exp_any(&vec![ReadUntil::String("hello"), ReadUntil::String("hell")]
With the input from the process as "hello",
will sometimes return "hell", and sometimes "hello".
Depending on how much the readbuffer happened to have collected.
With this change, the earliest match in the input will be matched.
That way, any difference in how much the read buffer has currently
consumed does not change the output of the exp_any function.
Signed-off-by: Erik Karlsson <triggger@gmail.com>ekarlsnforce-pushed
the
origin/any-returns-earliest-result
branch
from
September 12, 2022 08:59
834a9aa to
642e718Comparematthiasbeyer
approved these changes
Sep 12, 2022
matthiasbeyer
left a comment
Member
There was a problem hiding this comment.
👍 for also providing tests!
matthiasbeyer
commented
Sep 12, 2022
Member
I guess we can bors merge |
Contributor
Build succeeded: |
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 freeto 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.
Previously, exp_any would return the match with the lowest index in the list
So this
exp_any(&vec![ReadUntil::String("hello"), ReadUntil::String("hell")]With the input from the process as "hello", will sometimes return "hell", and sometimes "hello", depending on how much the readbuffer happened to have collected.