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

Adding get_input() to types that already have public as_str() 🏷️ #890

Merged
merged 7 commits into from Jul 16, 2023

Conversation

0nyr
Copy link
Contributor

@0nyr 0nyr commented Jul 16, 2023

Hello Pest team.

This PR is a followup to my last PR Merging Spans ♻️ #887.

In this last PR, I have introduced a getter for Span in order to be able to access the private input field of a Span. This allows to access the original input string without having to pass its reference everywhere in function arguments. In my personal project, I use this feature to be able to merge Spans.

There is no reason not to add this function to other types that also have this private field and a public as_str() function. I have added meaningful doc and tests and run cargo fmt.

I also renamed my tests to all have different names, making test debugging via commands like cargo test <get_input_test> -- --nocapture non-ambiguous.

@0nyr 0nyr requested a review from a team as a code owner July 16, 2023 12:51
@0nyr 0nyr requested review from tomtau and removed request for a team July 16, 2023 12:51
@tomtau tomtau merged commit ac0aed3 into pest-parser:master Jul 16, 2023
9 checks passed
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