mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 05:57:03 +03:00
doc: fix and expand explanation
I see that `extend()` is not called if new_len > len()
This commit is contained in:
@@ -859,8 +859,9 @@ pub fn split_off(&mut self, at: usize) -> Self {
|
||||
impl<T: Clone> Vec<T> {
|
||||
/// Resizes the `Vec` in-place so that `len()` is equal to `new_len`.
|
||||
///
|
||||
/// Calls either `extend()` or `truncate()` depending on whether `new_len`
|
||||
/// is larger than the current value of `len()` or not.
|
||||
/// If `new_len` is greater than `len()`, the `Vec` is extended by the
|
||||
/// difference, with each additional slot filled with `value`.
|
||||
/// If `new_len` is less than `len()`, the `Vec` is simply truncated.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user