Skip to content

Add more methods for mutating arbitrary ranges#59

Open
saecki wants to merge 4 commits intomainfrom
splice
Open

Add more methods for mutating arbitrary ranges#59
saecki wants to merge 4 commits intomainfrom
splice

Conversation

@saecki
Copy link
Member

@saecki saecki commented Mar 19, 2026

This adds the drain and splice methods for EcoVec, the implementation of these have been mostly copy pasted from the standard libaray.

A few more methods for mutating parts of an EcoString that are not at the end are also added:

  • remove
  • insert
  • insert_str

Notably this doesn't implement EcoString::drain, because the returned type would have to be some sort of fusion of the inline vs spilled drain implementation, which seemed a bit inelegant and too much work to implement.

Miri also seems to be happy :)

@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 80.13468% with 59 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.08%. Comparing base (36a2229) to head (aa02e0a).
⚠️ Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
src/vec/drain.rs 63.63% 24 Missing ⚠️
src/vec/splice.rs 74.62% 17 Missing ⚠️
src/slice.rs 48.27% 15 Missing ⚠️
src/dynamic.rs 95.58% 3 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #59      +/-   ##
==========================================
- Coverage   88.40%   84.08%   -4.32%     
==========================================
  Files           3        6       +3     
  Lines        1095     1257     +162     
==========================================
+ Hits          968     1057      +89     
- Misses        127      200      +73     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@saecki
Copy link
Member Author

saecki commented Mar 19, 2026

I think some more test cases for drain and splice wouldn't hurt. I'll add them later today.

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.

2 participants