Skip to main content

IsTty

Trait IsTty 

pub trait IsTty {
    // Required method
    fn is_tty(&self) -> bool;
}
Available on crate feature term only.
Expand description

Adds the is_tty method to types that might represent a terminal

use std::io::stdout;
use crossterm::tty::IsTty;

let is_tty: bool = stdout().is_tty();

Required Methods§

fn is_tty(&self) -> bool

Returns true when an instance is a terminal teletype, otherwise false.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

§

impl<S> IsTty for S
where S: AsRawFd,

Available on Unix and non-crate feature libc only.