Add built-in methods to bytes type#2341
Conversation
- Added split, splitlines, rsplit, strip, lstrip, rstrip, startswith, endswith, removeprefix, removesuffix, find, index, rfind, rindex, count, replace, join, partition, and rpartition to bytes type. - Added comprehensive tests in tests/bytes_methods.rs. - Ensured methods handle edge cases safely (empty pattern, pattern longer than source). Co-authored-by: nullmonk <15130760+nullmonk@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Summary
Previous Results
Insights
Test Changes0 test added, 0 removed Slowest Tests
🎉 No failed tests in this run. | 🍂 No flaky tests in this run. Github Test Reporter by CTRF 💚 |
KCarretto
left a comment
There was a problem hiding this comment.
Why do these methods need to be reimplemented for bytes? Most of them seem to rely on the bytes data being strings or the parameters being strings or some sort of casting. Can't we just str(mybytes).split("\n") in that case for example? If we absolutely must implement this for bytes, we should create an abstraction so that we don't need to maintain the code in two separate places.

Implemented a full set of Python-like built-in methods for the
bytestype ineldritch-core. This includes:split,rsplit,splitlinesstrip,lstrip,rstripstartswith,endswithremoveprefix,removesuffixfind,index,rfind,rindexcount,replace,join,partition,rpartitionAll methods were implemented in
implants/lib/eldritch/eldritch-core/src/interpreter/methods/bytes.rsand registered inmod.rs. A new test fileimplants/lib/eldritch/eldritch-core/tests/bytes_methods.rswas added to verify the functionality and ensure no regressions or panics on edge cases.PR created automatically by Jules for task 15367603936580828145 started by @nullmonk