bytes icon indicating copy to clipboard operation
bytes copied to clipboard

Utilities for working with bytes

Results 111 bytes issues
Sort by recently updated
recently updated
newest added

Adds `UninitSlice::split_at_mut`, a thin wrapper around [`slice::split_at_mut`](https://doc.rust-lang.org/std/primitive.slice.html#method.split_at_mut). This can make certain types of code much easier to write.

The documentation of the [BufMut::writer](https://docs.rs/bytes/1.0.1/bytes/buf/trait.BufMut.html#method.writer) claims that the returned writer will never fail: > This function returns a new value which implements Write by adapting the Write trait functions to...

This is left implicit in the documentation, would be better to make this explicit, I think?

The naming of `unsplit` is unfortunate because it can both revert a split *and* degenerate to `extend_from_slice`. Therefore I think that `join` is a better name that truly reflects what...

This would be the `Bytes` equivalent of [`WakerRef`](https://github.com/rust-lang-nursery/futures-rs/blob/master/futures-util/src/task/waker_ref.rs). If we do that, then we could switch `Bytes::slice_ref` -> `BytesRef::new(&my_bytes, my_slice)`... possibly even adding `BytesRef::new_unchecked`. Follow up to #298.

I stumbled upon https://github.com/rust-lang/rust/issues/27269 and noticed that it is fixed now, so I added an implementation. The implementation only covers `Take`, but I can't think of any more general type...

Consider code like this: ```rust use bytes::BufMut; fn main() { let mut buf = Vec::new(); buf.put_u8(42); print_slice(&buf, 1); } fn print_slice(slice: &[u8], len: usize) { println!("{:?}", &slice[..len]); } ``` We...

It is not clear how these traits should be implemented when the byte storage is not in continuous memory.

In `bytes` `0.4.x`, there was a method `Bytes::try_mut()` which would allow turning `Bytes` into (or back into) a `BytesMut` if it was the only pointer to the memory. This was...