Is your feature request related to a problem or challenge?
Because Pattern is still the unstable feature in rust, we introdce unsafe codes to get offset of the trimmed str(related disscussion #12387).
We can remove such codes once Pattern become stable, so that we can get such offset through safe way.
Describe the solution you'd like
Use Pattern to get the offset of trimmed str rather unsafe codes.
Describe alternatives you've considered
No response
Additional context
No response