fn ioctl_window_size() -> io::Result<(u16, u16)> {
    let mut w: Winsize = Default::default();
    match unsafe { libc::ioctl(libc::STDIN_FILENO, libc::TIOCGWINSZ, &mut w) } {
            0 => Ok((w.ws_row, w.ws_col)),
            _ => Err(io::Error::last_os_error()),
        }
        .and_then(|(row, col)| if col == 0 {
                      Err(io::Error::new(io::ErrorKind::Other, "ioctl error"))
                  } else {
                      Ok((row, col))
                  })
}
/// Get window size using ioctl if it is available
///
/// Uses the TIOCGWINSZ request (Terminal IO Get Window Size)
///
/// # Return value
/// Return the (height, width) of the terminal or an error
Get window size using ioctl if it is available
Uses the TIOCGWINSZ request (Terminal IO Get Window Size)
Get window size using ioctl if it is available Uses the TIOCGWINSZ request ( Terminal IO Get Window Size )
fn ioctl_window_size() -> io::Result<(u16, u16)> {
    let mut w: Winsize = Default::default();
    match unsafe { libc::ioctl(libc::STDIN_FILENO, libc::TIOCGWINSZ, &mut w) } {
            0 => Ok((w.ws_row, w.ws_col)),
            _ => Err(io::Error::last_os_error()),
        }
        .and_then(|(row, col)| if col == 0 {
                      Err(io::Error::new(io::ErrorKind::Other, "ioctl error"))
                  } else {
                      Ok((row, col))
                  })
}
fn ioctl_window_size ( ) -> io :: Result < ( u16 , u16 ) > { let mut w : Winsize = Default :: default ( ) ; match unsafe { libc :: ioctl ( libc :: STDIN_FILENO , libc :: TIOCGWINSZ , & mut w ) } { 0 => Ok ( ( w . ws_row , w . ws_col ) ) , _ => Err ( io :: Error :: last_os_error ( ) ) , } . and_then ( | ( row , col ) | if col == 0 { Err ( io :: Error :: new ( io :: ErrorKind :: Other , " " ) ) } else { Ok ( ( row , col ) ) } ) }
Get window size using ioctl if it is available
Uses the TIOCGWINSZ request (Terminal IO Get Window Size)
Get window size using ioctl if it is available Uses the TIOCGWINSZ request ( Terminal IO Get Window Size )
return value
Return the (height, width) of the terminal or an error
Return the ( height width ) of the terminal or an error