# Crate term [−] [src]

🔬 This is a nightly-only experimental API. (`rustc_private`)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?

Terminal formatting library.

This crate provides the `Terminal` trait, which abstracts over an ANSI Terminal to provide color printing, among other things. There are two implementations, the `TerminfoTerminal`, which uses control characters from a terminfo database, and `WinConsole`, which uses the Win32 Console API.

# Examples

    extern crate term;
    use std::io::prelude::*;

    fn main() {
        let mut t = term::stdout().unwrap();

        t.fg(term::color::GREEN).unwrap();
        write!(t, "hello, ").unwrap();

        t.fg(term::color::RED).unwrap();
        writeln!(t, "world!").unwrap();

        assert!(t.reset().unwrap());
    }Run

## Re-exports

`pub use terminfo::TerminfoTerminal;`

## Modules

color | [ Experimental ] Terminal color definitions
terminfo | [ Experimental ] Terminfo database interface.

## Enums

Attr | [ Experimental ] Terminal attributes for use with term.attr().

## Traits

Terminal | [ Experimental ] A terminal with similar capabilities to an ANSI Terminal (foreground/background colors etc).

## Functions

stderr | [ Experimental ] Return a Terminal wrapping stderr, or None if a terminal couldn't be opened.
stdout | [ Experimental ] Return a Terminal wrapping stdout, or None if a terminal couldn't be opened.

## Type Definitions

StderrTerminal | [ Experimental ] Alias for stderr terminals.
StdoutTerminal | [ Experimental ] Alias for stdout terminals.

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)