Implement ExtendInto for String, allowing dynamic-length escape replacements #1865
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.
Howdy! This is a follow-up PR to resolve the issue I mentioned in a comment earlier this evening: #1206 (comment)
This trait implementation would allow me to stop interning strings (or doing other hackarounds to get all branches of a call to
altto return&str, the only useful thing for my purposes that implementsExtendIntoso far) in my string literal parser, which would also let me drop an entire crate worth of dependency!I hope the included unit test helps illustrate how this could be used - the logic of "escape double quotes, and pass all other escape sequences through to the output" is fairly similar to how Python's raw string literals work, if you're familiar.
Cheers!