fn rows(&self) -> impl IntoIterator<Item = String> {
            let grid = self.grid.clone();
            let (width, height) = terminal_size().unwrap_or((100, 40));
            let axes = ((width / 2) as isize, (height / 2) as isize);
            let minima = (-axes.0, -axes.1);
            let maxima = match (width, height) {
                (x, y) if x % 2 == 0 && y % 2 == 0 => (axes.0 - 1, axes.1 - 1),
                (x, _) if x % 2 == 0 => (axes.0 - 1, axes.1),
                (_, y) if y % 2 == 0 => (axes.0, axes.1 - 1),
                (_, _) => axes,
            };
            let mut rows = Vec::with_capacity(height as usize);
            for y in minima.1..maxima.1 {
                let mut s = String::with_capacity((width as usize) * 2);
                for x in minima.0..maxima.0 {
                    let idx = index!(x, y);
                    s.push_str(if grid.is_living(&idx) { LIVE } else { DEAD });
                }
                rows.push(s);
            }
            rows
        }
/// Returns the row-by-row output for this viewport.
Returns the row-by-row output for this viewport.
Returns the row - by - row output for this viewport .
fn rows(&self) -> impl IntoIterator<Item = String> {
            let grid = self.grid.clone();
            let (width, height) = terminal_size().unwrap_or((100, 40));
            let axes = ((width / 2) as isize, (height / 2) as isize);
            let minima = (-axes.0, -axes.1);
            let maxima = match (width, height) {
                (x, y) if x % 2 == 0 && y % 2 == 0 => (axes.0 - 1, axes.1 - 1),
                (x, _) if x % 2 == 0 => (axes.0 - 1, axes.1),
                (_, y) if y % 2 == 0 => (axes.0, axes.1 - 1),
                (_, _) => axes,
            };
            let mut rows = Vec::with_capacity(height as usize);
            for y in minima.1..maxima.1 {
                let mut s = String::with_capacity((width as usize) * 2);
                for x in minima.0..maxima.0 {
                    let idx = index!(x, y);
                    s.push_str(if grid.is_living(&idx) { LIVE } else { DEAD });
                }
                rows.push(s);
            }
            rows
        }
fn rows ( & self ) -> impl IntoIterator < Item = String > { let grid = self . grid . clone ( ) ; let ( width , height ) = terminal_size ( ) . unwrap_or ( ( 100 , 40 ) ) ; let axes = ( ( width / 2 ) as isize , ( height / 2 ) as isize ) ; let minima = ( - axes . 0 , - axes . 1 ) ; let maxima = match ( width , height ) { ( x , y ) if x % 2 == 0 && y % 2 == 0 => ( axes . 0 - 1 , axes . 1 - 1 ) , ( x , _ ) if x % 2 == 0 => ( axes . 0 - 1 , axes . 1 ) , ( _ , y ) if y % 2 == 0 => ( axes . 0 , axes . 1 - 1 ) , ( _ , _ ) => axes , } ; let mut rows = Vec :: with_capacity ( height as usize ) ; for y in minima . 1 .. maxima . 1 { let mut s = String :: with_capacity ( ( width as usize ) * 2 ) ; for x in minima . 0 .. maxima . 0 { let idx = index ! ( x y ) ; s . push_str ( if grid . is_living ( & idx ) { LIVE } else { DEAD } ) ; } rows . push ( s ) ; } rows }
Returns the row-by-row output for this viewport.
Returns the row - by - row output for this viewport .
&self
&self