Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make is_a example more obvious #1663

Merged
merged 1 commit into from
Jun 10, 2023

Conversation

smheidrich
Copy link
Contributor

@smheidrich smheidrich commented May 9, 2023

In the "Choosing a combinator" guide, the example for is_a is to run is_a("ab") on ababc, returning Ok("c", "abab"). The example by itself (without the accompanying explanation) leaves ambiguous whether the reason is_a produced that output was because it parsed ab twice (wrong - that's what tag is for) or because it parsed a or b 4 times (correct). IMHO it would be better if, at least for simple functions like that, it was immediately obvious from the examples alone what they do, or at least for the examples to dispel any confusion remaining after reading the explanations. In this case that can be accomplished by just using abbac as the example string instead, which this MR does.

@smheidrich smheidrich requested a review from Geal as a code owner May 9, 2023 19:44
@Geal
Copy link
Collaborator

Geal commented Jun 10, 2023

good idea yes, the examples should be more obvious

@Geal Geal merged commit d0d7cb4 into rust-bakery:main Jun 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants