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

Add a "fast_wrap" function that reuses the input string #58

Closed
mgeisler opened this issue May 23, 2017 · 1 comment
Closed

Add a "fast_wrap" function that reuses the input string #58

mgeisler opened this issue May 23, 2017 · 1 comment

Comments

@mgeisler
Copy link
Owner

The current wrap method allocates completely new strings for each line. This is necessary is one wants to support automatic hyphenation since the output can be different from the input in that case.

However, for the simple case with no hyphenation, it should be possible to return Vec<&str> where each &str is a slice of the original input string. This would mean fewer allocations and no copying of data, which ought to be faster.

@mgeisler
Copy link
Owner Author

Fixed by #69.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant