Skip to content

Replace ByteStr with SliceWithIndices and SerdeByteStr#7748

Open
Manishearth wants to merge 5 commits intounicode-org:mainfrom
Manishearth:rm-bytestr
Open

Replace ByteStr with SliceWithIndices and SerdeByteStr#7748
Manishearth wants to merge 5 commits intounicode-org:mainfrom
Manishearth:rm-bytestr

Conversation

@Manishearth
Copy link
Member

@Manishearth Manishearth commented Mar 7, 2026

Fixes #7725

This was primarily agent-driven.

ByteStr is used in const code to abstract over &[(T, usize)] where T can be &str or &[u8]. SliceWithIndices is the same concept represented as an enum. This is builder code, so it doesn't matter that much.

ByteStr was also used in serde code to allow serializing/deserializing from a byte sequence or a string. I'm not 100% clear if that is actually still necessary: can we just ser/de the store. I didn't want to break anything, so I kept the existing behavior. I'm hoping @sffc can have a look and perform further cleanups if necessary.

I did need to add an either dependency to write a convenient iterator type. It's internal, so I can also choose to not do that and iterate manually instead. Figured out a cleaner way to do it.

@Manishearth Manishearth requested a review from a team as a code owner March 7, 2026 02:32
@Manishearth Manishearth requested a review from sffc March 7, 2026 02:32
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.

ByteStr in zerotrie is theoretically unsound

1 participant