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

The functions could return a Cow #11

Open
mzabaluev opened this issue Nov 28, 2017 · 0 comments
Open

The functions could return a Cow #11

mzabaluev opened this issue Nov 28, 2017 · 0 comments

Comments

@mzabaluev
Copy link

As an optimization for the case when the slice length is not less than the padded size, the original slice could be returned in a Cow::Borrowed.

Changing the return type would be a breaking change, so if you have an established base of developers depending on your crate with leftpad = "*" and you don't want to upset them, a couple of functions could be added alongside:

  • left_pad_to_cow
  • left_pad_char_to_cow
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

No branches or pull requests

1 participant