pub fn new(out: T) -> io::Result<WinConsole<T>> {
        let fg;
        let bg;
        unsafe {
            let mut buffer_info = ::std::mem::uninitialized();
            if GetConsoleScreenBufferInfo(GetStdHandle(-11i32 as DWORD), &mut buffer_info) != 0 {
                fg = bits_to_color(buffer_info.wAttributes);
                bg = bits_to_color(buffer_info.wAttributes >> 4);
            } else {
                fg = color::WHITE;
                bg = color::BLACK;
            }
        }
        Ok(WinConsole {
            buf: out,
            def_foreground: fg,
            def_background: bg,
            foreground: fg,
            background: bg,
        })
    }
/// Returns `None` whenever the terminal cannot be created for some
/// reason.
Returns `None` whenever the terminal cannot be created for some
reason.
Returns ` None ` whenever the terminal cannot be created for some reason .
pub fn new(out: T) -> io::Result<WinConsole<T>> {
        let fg;
        let bg;
        unsafe {
            let mut buffer_info = ::std::mem::uninitialized();
            if GetConsoleScreenBufferInfo(GetStdHandle(-11i32 as DWORD), &mut buffer_info) != 0 {
                fg = bits_to_color(buffer_info.wAttributes);
                bg = bits_to_color(buffer_info.wAttributes >> 4);
            } else {
                fg = color::WHITE;
                bg = color::BLACK;
            }
        }
        Ok(WinConsole {
            buf: out,
            def_foreground: fg,
            def_background: bg,
            foreground: fg,
            background: bg,
        })
    }
pub fn new ( out : T ) -> io :: Result < WinConsole < T > > { let fg ; let bg ; unsafe { let mut buffer_info = :: std :: mem :: uninitialized ( ) ; if GetConsoleScreenBufferInfo ( GetStdHandle ( - 11i32 as DWORD ) , & mut buffer_info ) != 0 { fg = bits_to_color ( buffer_info . wAttributes ) ; bg = bits_to_color ( buffer_info . wAttributes >> 4 ) ; } else { fg = color :: WHITE ; bg = color :: BLACK ; } } Ok ( WinConsole { buf : out , def_foreground : fg , def_background : bg , foreground : fg , background : bg , } ) }
Returns `None` whenever the terminal cannot be created for some
reason.
Returns ` None ` whenever the terminal cannot be created for some reason .
out
T
out
T