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

Implement all traits for all arrays (fixes #1) #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

birkenfeld
Copy link

No description provided.

daboross added a commit to daboross/smallstring that referenced this pull request Feb 13, 2018
To clarify: this is for methods which are present on both, not things
unique to one or the other. It wouldn't make sense to support set_len
like SmallVec::set_len, or as_mut_vec like String::as_mut_vec.

This commit:
- 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, and use it to more efficiently implement FromIterator
  - previous FromIterator implementation did not pre-reserve capacity.
  - new one matches behavior of String::from_iterator - to reserve as if
    data was ASCII. This will be as or more efficient than old behavior
    in all situations, and is smaller code.
- updates underlying SmallVec crate to achieve full functionality
- many more trait implementations to closer match String's and SmallVec's
  shared API surface
- implements some From implementations more efficiently using direct byte
  copies instead of the iterator API
- formats code - this can be removed from commit if necessary, but it made
  developing much nicer to consistently format using rustfmt.

Closes jFransham#1.
Closes jFransham#2.
Closes jFransham#3.
daboross added a commit to daboross/smallstring that referenced this pull request Feb 13, 2018
To clarify: this is for methods which are present on both, not things
unique to one or the other. It wouldn't make sense to support set_len
like SmallVec::set_len, or as_mut_vec like String::as_mut_vec.

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.
- 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.

Closes jFransham#1.
Closes jFransham#2.
Closes jFransham#3.
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

Successfully merging this pull request may close these issues.

1 participant