pub fn resize(&mut self, new_len: usize, value: T) -> Result<(), BufferFullError>
    where
        T: Clone,
    {
        if new_len > self.capacity() {
            return Err(BufferFullError);
        }

        if new_len > self.len {
            while self.len < new_len {
                self.push(value.clone())?;
            }
        } else {
            self.truncate(new_len);
        }

        Ok(())
    }
/// Resizes the Vec in-place so that len is equal to new_len.
///
/// 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.
///
/// See also [`resize_default`].
Resizes the Vec in-place so that len is equal to new_len.
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.


Resizes the Vec in - place so that len is equal to new_len . 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 .
pub fn resize(&mut self, new_len: usize, value: T) -> Result<(), BufferFullError>
    where
        T: Clone,
    {
        if new_len > self.capacity() {
            return Err(BufferFullError);
        }
        if new_len > self.len {
            while self.len < new_len {
                self.push(value.clone())?;
            }
        } else {
            self.truncate(new_len);
        }
        Ok(())
    }
pub fn resize ( & mut self , new_len : usize , value : T ) -> Result < ( ) , BufferFullError > where T : Clone , { if new_len > self . capacity ( ) { return Err ( BufferFullError ) ; } if new_len > self . len { while self . len < new_len { self . push ( value . clone ( ) ) ? ; } } else { self . truncate ( new_len ) ; } Ok ( ( ) ) }
Resizes the Vec in-place so that len is equal to new_len.
Resizes the Vec in - place so that len is equal to new_len .
&mut self
new_len
usize
value
T
&mut self
new_len
usize
value
T