smallstring icon indicating copy to clipboard operation
smallstring copied to clipboard

Implement functionality present on String and SmallVec

Open daboross opened this issue 6 years ago • 0 comments

This adds a large amount of functionality to SmallString.

I've found the library very useful, so I thought this would be a good way to contribute back.

Most methods which make sense from String and SmallVec are now implemented on SmallString.

This PR:

  • removes default size = [u8; 8] to match behavior of SmallVec
  • implements many methods available on SmallVec but not SmallString
  • implements AsMut without feature gate and without requiring rust 1.20+
  • implements Extend efficiently with pre-reserved capacity
  • re-implements FromIterator more simply
    • the previous FromIterator implementation worked well and was efficient, but it's possible to achieve the same result without creating a whole struct implementing Iterator. The new behavior matches String::from_iterator.
  • updates smallvec crate dependency to achieve full functionality
  • implements many more traits which can be implemented
  • implements some From implementations more efficiently using direct byte-for-byte copies rather than collect() on an iterator.
  • bumps version to '0.2.0' to prepare for release.

Fixes #1, supersedes #2, #3.

daboross avatar Feb 13 '18 18:02 daboross