Skip to content

Commit 972f538

Browse files
authored
docs: Clarify what BytesMut is (#375)
1 parent 81550da commit 972f538

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/bytes_mut.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ use crate::{Buf, BufMut, Bytes};
2222
///
2323
/// `BytesMut` represents a unique view into a potentially shared memory region.
2424
/// Given the uniqueness guarantee, owners of `BytesMut` handles are able to
25-
/// mutate the memory. It is similar to a `Vec<u8>` but with less copies and
26-
/// allocations.
25+
/// mutate the memory.
26+
///
27+
/// `BytesMut` can be thought of as containing a `buf: Arc<Vec<u8>>`, an offset
28+
/// into `buf`, a slice length, and a guarantee that no other `BytesMut` for the
29+
/// same `buf` overlaps with its slice. That guarantee means that a write lock
30+
/// is not required.
2731
///
2832
/// # Growth
2933
///

0 commit comments

Comments
 (0)