docs: Clarify what BytesMut is (#375)

This commit is contained in:
Sean Leather
2020-07-09 18:11:45 +02:00
committed by GitHub
parent b83ea40780
commit 6ccbcdfbc0
+6 -2
View File
@@ -22,8 +22,12 @@ use crate::{Buf, BufMut, Bytes};
///
/// `BytesMut` represents a unique view into a potentially shared memory region.
/// Given the uniqueness guarantee, owners of `BytesMut` handles are able to
/// mutate the memory. It is similar to a `Vec<u8>` but with less copies and
/// allocations.
/// mutate the memory.
///
/// `BytesMut` can be thought of as containing a `buf: Arc<Vec<u8>>`, an offset
/// into `buf`, a slice length, and a guarantee that no other `BytesMut` for the
/// same `buf` overlaps with its slice. That guarantee means that a write lock
/// is not required.
///
/// # Growth
///