10 个版本

使用旧 Rust 2015

0.2.0 2018年9月9日
0.1.9 2018年9月7日
0.1.8 2018年5月23日
0.1.7 2018年4月10日
0.1.1 2016年6月6日

#23 in #three

Download history · Rust 包仓库 2216/week @ 2024-03-13 · Rust 包仓库 2824/week @ 2024-03-20 · Rust 包仓库 2730/week @ 2024-03-27 · Rust 包仓库 2946/week @ 2024-04-03 · Rust 包仓库 2751/week @ 2024-04-10 · Rust 包仓库 2913/week @ 2024-04-17 · Rust 包仓库 2786/week @ 2024-04-24 · Rust 包仓库 2638/week @ 2024-05-01 · Rust 包仓库 2604/week @ 2024-05-08 · Rust 包仓库 2806/week @ 2024-05-15 · Rust 包仓库 2658/week @ 2024-05-22 · Rust 包仓库 2945/week @ 2024-05-29 · Rust 包仓库 2545/week @ 2024-06-05 · Rust 包仓库 2126/week @ 2024-06-12 · Rust 包仓库 2652/week @ 2024-06-19 · Rust 包仓库 2461/week @ 2024-06-26 · Rust 包仓库

10,255 每月下载量
少于 21 crates 中使用

MIT/Apache

6KB

Rust isatty

Build Status Build Status Latest Version

此 crate 提供以下三个函数

fn stdin_isatty() -> bool
fn stdout_isatty() -> bool
fn stderr_isatty() -> bool

在 Linux 和 Mac 上,它们通过 libc::isatty 实现。在 Windows 上,它们通过 consoleapi::GetConsoleMode 实现。

stdin_isatty 函数尚未在 Windows 上实现。如果您需要它,请检查 dtolnay/isatty#1 并贡献一个实现!


用法

Cargo.toml

[dependencies]
isatty = "0.1"

src/main.rs

extern crate isatty;
use isatty::{stdin_isatty, stdout_isatty, stderr_isatty};

fn main() {
    println!("stdin: {}", stdin_isatty());
    println!("stdout: {}", stdout_isatty());
    println!("stderr: {}", stderr_isatty());
}

许可协议

许可协议为 Apache License, Version 2.0 或 MIT 许可协议之一。
除非您明确说明,否则您提交给此 crate 的任何有意贡献,根据 Apache-2.0 许可证定义,应如上所述双重许可,不附加任何其他条款或条件。

无运行时依赖项