pub trait Contract {
// Required method
fn contract(&mut self, count: usize);
}Expand description
Opposite of Extend.
Required Methods§
Sourcefn contract(&mut self, count: usize)
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
Available on crate feature alloc only.Pops some number of characters off the end of the string.
impl Contract for String
Available on crate feature
alloc only.Pops some number of characters off the end of the string.
Source§impl<T> Contract for LinkedList<T>
Available on crate feature alloc only.Pops items off the back of the LinkedList.
impl<T> Contract for LinkedList<T>
Available on crate feature
alloc only.Pops items off the back of the LinkedList.
Source§impl<T> Contract for VecDeque<T>
Available on crate feature alloc only.Pops items off the back of the VecDeque.
impl<T> Contract for VecDeque<T>
Available on crate feature
alloc only.Pops items off the back of the VecDeque.