Trait kwap_common::Insert[][src]

pub trait Insert<T>: GetSize {
    fn insert_at(&mut self, index: usize, value: T);

    fn push(&mut self, value: T) { ... }
}
Expand description

Insert items into collections

use kwap_common::Insert;

let mut nums = vec![1, 2, 3];
Insert::push(&mut nums, 4);
assert_eq!(nums, vec![1, 2, 3, 4]);

nums.insert_at(0, 0);
assert_eq!(nums, vec![0, 1, 2, 3, 4]);

Required methods

Insert a value at a particular index of a collection.

Provided methods

Add a value to the end of a collection.

Implementations on Foreign Types

Implementors