aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Christopher Hotchkiss <christopher.hotchkiss@gmail.com> 2021-08-24 10:12:20 -0400
committerGravatar GitHub <noreply@github.com> 2021-08-24 16:12:20 +0200
commit55e296850d3de4563ef5b260b076e6c697391604 (patch)
treec8ceb627d1a3c7762fc5380b9853732b5186db74 /src
parent0e9fa0b602eb0fb977e2e900cf43532cd869d6b3 (diff)
downloadbytes-55e296850d3de4563ef5b260b076e6c697391604.tar.gz
bytes-55e296850d3de4563ef5b260b076e6c697391604.tar.zst
bytes-55e296850d3de4563ef5b260b076e6c697391604.zip
Clarifying actions of clear and truncate. (#508)
Diffstat (limited to 'src')
-rw-r--r--src/bytes_mut.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/bytes_mut.rs b/src/bytes_mut.rs
index b754ed1..147484d 100644
--- a/src/bytes_mut.rs
+++ b/src/bytes_mut.rs
@@ -380,6 +380,8 @@ impl BytesMut {
/// If `len` is greater than the buffer's current length, this has no
/// effect.
///
+ /// Existing underlying capacity is preserved.
+ ///
/// The [`split_off`] method can emulate `truncate`, but this causes the
/// excess bytes to be returned instead of dropped.
///
@@ -402,7 +404,7 @@ impl BytesMut {
}
}
- /// Clears the buffer, removing all data.
+ /// Clears the buffer, removing all data. Existing capacity is preserved.
///
/// # Examples
///