Refactor Bytes to use an internal vtable (#298)
Bytes is a useful tool for managing multiple slices into the same region of memory, and the other things it used to have been removed to reduce complexity. The exact strategy for managing the multiple references is no longer hard-coded, but instead backing by a customizable vtable. - Removed ability to mutate the underlying memory from the `Bytes` type. - Removed the "inline" (SBO) mechanism in `Bytes`. The reduces a large amount of complexity, and improves performance when accessing the slice of bytes, since a branch is no longer needed to check if the data is inline. - Removed `Bytes` knowledge of `BytesMut` (`BytesMut` may grow that knowledge back at a future point.)
Showing
- Cargo.toml 1 addition, 0 deletionsCargo.toml
- benches/bytes.rs 20 additions, 152 deletionsbenches/bytes.rs
- benches/bytes_mut.rs 142 additions, 0 deletionsbenches/bytes_mut.rs
- ci/azure-cross-compile.yml 1 addition, 1 deletionci/azure-cross-compile.yml
- ci/azure-tsan.yml 2 additions, 2 deletionsci/azure-tsan.yml
- ci/tsan 0 additions, 4 deletionsci/tsan
- src/buf/chain.rs 0 additions, 8 deletionssrc/buf/chain.rs
- src/buf/vec_deque.rs 0 additions, 19 deletionssrc/buf/vec_deque.rs
- src/bytes.rs 366 additions, 2472 deletionssrc/bytes.rs
- src/bytes_mut.rs 1429 additions, 0 deletionssrc/bytes_mut.rs
- src/lib.rs 26 additions, 1 deletionsrc/lib.rs
- src/loom.rs 5 additions, 0 deletionssrc/loom.rs
- src/serde.rs 7 additions, 7 deletionssrc/serde.rs
- tests/fuzz_bytes.rs 73 additions, 0 deletionstests/fuzz_bytes.rs
- tests/test_buf.rs 16 additions, 0 deletionstests/test_buf.rs
- tests/test_buf_mut.rs 9 additions, 1 deletiontests/test_buf_mut.rs
- tests/test_bytes.rs 79 additions, 162 deletionstests/test_bytes.rs
Loading
Please register or sign in to comment