mirror of
https://github.com/openharmony/third_party_rust_bytes.git
synced 2026-07-18 00:04:34 -04: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.
|
||||
/// 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
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user