Document that BytesMut::{reserve,try_reserve} doesn't preserve unused capacity (#808)

This commit is contained in:
Paolo Barbolini
2025-11-28 10:02:34 +01:00
committed by GitHub
parent acd1e0ffb8
commit 94e42915a9
+4
View File
@@ -551,6 +551,8 @@ impl BytesMut {
/// and the original buffer is large enough to fit the requested additional /// and the original buffer is large enough to fit the requested additional
/// capacity, then reallocations will never happen. /// capacity, then reallocations will never happen.
/// ///
/// This method does not preserve data stored in the unused capacity.
///
/// # Examples /// # Examples
/// ///
/// In the following example, a new buffer is allocated. /// In the following example, a new buffer is allocated.
@@ -797,6 +799,8 @@ impl BytesMut {
/// references through other `BytesMut`s or `Bytes` which point to the same underlying /// references through other `BytesMut`s or `Bytes` which point to the same underlying
/// storage. /// storage.
/// ///
/// This method does not preserve data stored in the unused capacity.
///
/// # Examples /// # Examples
/// ///
/// ``` /// ```