From 55e296850d3de4563ef5b260b076e6c697391604 Mon Sep 17 00:00:00 2001 From: Christopher Hotchkiss Date: Tue, 24 Aug 2021 10:12:20 -0400 Subject: [PATCH] Clarifying actions of clear and truncate. (#508) --- src/bytes_mut.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bytes_mut.rs b/src/bytes_mut.rs index b754ed1fc..147484d53 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 ///