smallstring
smallstring copied to clipboard
Implement functionality present on String and SmallVec
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 notSmallString
- 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 matchesString::from_iterator
.
- the previous
- 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.