/// Resize the grid to the given dimensions. Return `true` if this
/// caused any existing vertex to be discarded.
Resize the grid to the given dimensions. Return `true` if this
caused any existing vertex to be discarded.
Resize the grid to the given dimensions . Return ` true ` if this caused any existing vertex to be discarded .
pub fn resize(&mut self, width: usize, height: usize) -> bool {
        let mut truncated = false;
        if width < self.width {
            truncated |= iproduct!(width..self.width, 0..self.height).any(|c| self.has_vertex(c));
        }
        if height < self.height {
            truncated |= iproduct!(0..self.width, height..self.height).any(|c| self.has_vertex(c));
        }
        self.exclusions.retain(|&(x, y)| x < width && y < height);
        if self.dense {
            for vertex in iproduct!(self.width..width, 0..height) {
                self.exclusions.insert(vertex);
            }
            for vertex in iproduct!(0..self.width.min(width), self.height..height) {
                self.exclusions.insert(vertex);
            }
        }
        self.width = width;
        self.height = height;
        self.rebalance();
        truncated
    }
pub fn resize ( & mut self , width : usize , height : usize ) -> bool { let mut truncated = false ; if width < self . width { truncated |= iproduct ! ( width self width 0 self height ) . any ( | c | self . has_vertex ( c ) ) ; } if height < self . height { truncated |= iproduct ! ( 0 self width height self height ) . any ( | c | self . has_vertex ( c ) ) ; } self . exclusions . retain ( | & ( x , y ) | x < width && y < height ) ; if self . dense { for vertex in iproduct ! ( self width width 0 height ) { self . exclusions . insert ( vertex ) ; } for vertex in iproduct ! ( 0 self width min ( width ) self height height ) { self . exclusions . insert ( vertex ) ; } } self . width = width ; self . height = height ; self . rebalance ( ) ; truncated }
Resize the grid to the given dimensions.
Resize the grid to the given dimensions .
&mut self
width
usize
height
usize