Add notes about capacity effects to Vec::truncate()
This commit is contained in:
parent
2425b22774
commit
4be5783748
@ -999,6 +999,9 @@ impl String {
|
||||
/// If `new_len` is greater than the string's current length, this has no
|
||||
/// effect.
|
||||
///
|
||||
/// Note that this method has no effect on the allocated capacity
|
||||
/// of the string
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if `new_len` does not lie on a [`char`] boundary.
|
||||
|
@ -545,6 +545,9 @@ impl<T> Vec<T> {
|
||||
/// The [`drain`] method can emulate `truncate`, but causes the excess
|
||||
/// elements to be returned instead of dropped.
|
||||
///
|
||||
/// Note that this method has no effect on the allocated capacity
|
||||
/// of the vector.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Truncating a five element vector to two elements:
|
||||
@ -1089,6 +1092,9 @@ impl<T> Vec<T> {
|
||||
|
||||
/// Clears the vector, removing all values.
|
||||
///
|
||||
/// Note that this method has no effect on the allocated capacity
|
||||
/// of the vector.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
|
Loading…
x
Reference in New Issue
Block a user