Skip to content

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

Merged
tomtau merged 7 commits intopest-parser:masterfrom
0nyr:master
Jul 16, 2023
Merged

Adding get_input() to types that already have public as_str() 🏷️#890
tomtau merged 7 commits intopest-parser:masterfrom
0nyr:master

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
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.

2 participants