bytes
bytes copied to clipboard
Utilities for working with bytes
Basically: https://linux.die.net/man/3/atoi `std` already provides such a conversion from `&str` but not directly from `&[u8]`
Create a new `SharedInline` `Bytes` representation, which is: ``` struct SharedInline { ref_cnt: AtomicUsize, cap: usize, // data: [u8; cap], } ``` The advantage of this representation is that we...
Sometimes when encoding or decoding, it can be desirable to "rewind" a read or write operation. Some examples: - When decoding, after reading a `u32` that describes the "length" of...
I try to use serde for serialization data from my structs to BytesMut (it's default buffer type for tokio encoder). For serialization [u8; 16] serde call serialize_u8 method: ``` fn...
This takes the `into_vec` function from [this PR](https://github.com/carllerche/bytes/pull/90) and makes it work on master. It also extends it with an equivalent `BytesMut` version and a `Into` impl for each.
Currently, `bytes_vectored` takes a slice of initialized `IoSliceMut`. This has two drawbacks: * If one wants to be pretty sure that the slice will have sufficient length, he may want...
Add `try_get_*` methods on `Buf` which return error values rather than panicking when there are not enough remaining bytes. This allows for cleaner networking code when dealing with variable-length packets....
I really like the approach that had been taken with #294 and #298. That makes it feasible to wrap arbitrary buffers with `Bytes` as long as they can be cloned,...
An impl of bit-wise xor of two Bytes, returning None if both Bytes are not of the same length.