nutmeg 0.1.6

An unopinionated progress bar library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use std::{
    io::{stderr, stdout},
    os::windows::io::AsHandle,
};

use terminal_size::{terminal_size_of, Width};

pub(crate) fn stdout_width() -> Option<usize> {
    terminal_size_of(stdout().as_handle()).map(|(Width(w), _)| w as usize)
}

pub(crate) fn stderr_width() -> Option<usize> {
    terminal_size_of(stderr().as_handle()).map(|(Width(w), _)| w as usize)
}