Trunc

Trait Trunc 

Source
pub trait Trunc
where Self: Sized,
{ // Required method fn trunc(&mut self, len: usize); // Provided method fn clear(&mut self) { ... } }
Expand description

Truncate this collection to a new length.

If self was shorter than len, nothing happens.

If self was longer, drops elements up to len

Required Methods§

Source

fn trunc(&mut self, len: usize)

Provided Methods§

Source

fn clear(&mut self)

Erase all elements in the collection

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T> Trunc for Vec<T>

Available on crate feature alloc only.
Source§

fn trunc(&mut self, len: usize)

Source§

impl<T, const N: usize> Trunc for ArrayVec<[T; N]>
where T: Default,

Source§

fn trunc(&mut self, len: usize)

Implementors§