mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-27 00:00:17 +02:00
docs: Clarify what BytesMut is (#375)
This commit is contained in:
+6
-2
@@ -22,8 +22,12 @@ use crate::{Buf, BufMut, Bytes};
|
|||||||
///
|
///
|
||||||
/// `BytesMut` represents a unique view into a potentially shared memory region.
|
/// `BytesMut` represents a unique view into a potentially shared memory region.
|
||||||
/// Given the uniqueness guarantee, owners of `BytesMut` handles are able to
|
/// 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
|
/// mutate the memory.
|
||||||
/// allocations.
|
///
|
||||||
|
/// `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
|
/// # Growth
|
||||||
///
|
///
|
||||||
|
|||||||
Reference in New Issue
Block a user