Clarifying actions of clear and truncate. (#508)

This commit is contained in:
Christopher Hotchkiss
2021-08-24 16:12:20 +02:00
committed by GitHub
parent 0e9fa0b602
commit 55e296850d
+3 -1
View File
@@ -380,6 +380,8 @@ impl BytesMut {
/// If `len` is greater than the buffer's current length, this has no /// If `len` is greater than the buffer's current length, this has no
/// effect. /// effect.
/// ///
/// Existing underlying capacity is preserved.
///
/// The [`split_off`] method can emulate `truncate`, but this causes the /// The [`split_off`] method can emulate `truncate`, but this causes the
/// excess bytes to be returned instead of dropped. /// 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 /// # Examples
/// ///