Trait Contract

Source
pub trait Contract {
    // Required method
    fn contract(&mut self, count: usize);
}
Expand description

Opposite of Extend.

Required Methods§

Source

fn contract(&mut self, count: usize)

Contracts the collection, removing the given number of items from its end.

§Overflow Behavior

This method may panic if count is larger than the size of the collection. Since this check may incur performance penalities, it is only guaranteed if debug assertions are enabled.

In these cases, the collection must still correctly remove the elements, but may decide to not notify the user that less than the count of items were removed.

Implementations on Foreign Types§

Source§

impl Contract for String

Pops some number of characters off the end of the string.

Source§

fn contract(&mut self, count: usize)

Source§

impl<T> Contract for LinkedList<T>

Pops items off the back of the LinkedList.

Source§

fn contract(&mut self, count: usize)

Source§

impl<T> Contract for VecDeque<T>

Pops items off the back of the VecDeque.

Source§

fn contract(&mut self, count: usize)

Source§

impl<T> Contract for Vec<T>

Pops items off the Vec.

Source§

fn contract(&mut self, count: usize)

Implementors§