google/zerocopy

Split ByteSlice::split_at into separate trait

Closed this issue · 0 comments

Migrated from https://fxbug.dev/76635

Currently, we don't implement ByteSlice for Vec<u8> because it would be expensive to implement the split_at method. However, most uses of ByteSlice don't make use of this method. We should split ByteSlice into multiple traits and only use the trait with the split_at method where it's actually necessary. Vec can then implement the base trait but not the trait with the split_at method.

Possible names for these traits: ByteSlice and SplittableByteSlice.