i_shape 2.0.0

iShape is a compact and efficient library specifically designed for representing 2D data structures using IntPoint.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use alloc::vec::Vec;

pub trait Reserve {
    fn reserve_capacity(&mut self, new_capacity: usize);
}

impl<T> Reserve for Vec<T> {
    #[inline]
    fn reserve_capacity(&mut self, new_capacity: usize) {
        let old_capacity = self.capacity();
        if old_capacity < new_capacity {
            let additional = new_capacity - old_capacity;
            self.reserve(additional);
        }
    }
}