[][src]Crate crossterm

Crossterm

Have you ever been disappointed when a terminal library for rust was only written for UNIX systems? Crossterm provides clearing, input handling, styling, cursor movement, and terminal actions for both Windows and UNIX systems.

Crossterm aims to be simple and easy to call in code. Through the simplicity of Crossterm, you do not have to worry about the platform you are working with.

This crate supports all UNIX and Windows terminals down to Windows 7 (not all terminals are tested see Tested Terminals for more info).

Important

This crate re-exports all other crossterm_* crates types only. Please, consult the crossterm crate repository README to learn how to use features to enable/disable functionality, what's planned, etc. There will be new code organization, breaking API changes, etc.

Macros

execute

Execute one or more command(s)

queue

Queue one or more command(s) for execution in the near future.

Structs

AlternateScreen

An alternate screen.

AsyncReader

An asynchronous input reader (not blocking).

BlinkOff

A command to disable the cursor blinking.

BlinkOn

A command to enable the cursor blinking.

Clear

A command to clear the terminal.

Crossterm

A crossterm functionality wrapper.

Down

A command to move the cursor given rows down.

EnterAlternateScreen

A command to switch to the alternate screen.

Goto

A command to move the cursor to the given position.

Hide

A command to hide the cursor.

LeaveAlternateScreen

A command to switch back to the main screen.

Left

A command to move the cursor given columns left.

ObjectStyle

An object style.

Output

When executed, this command will output the given string to the terminal.

PrintStyledFont

A command to print the styled object.

RawScreen

A raw screen.

ResetColor

A command to reset the colors back to default ones.

ResetPos

A command to restore the saved cursor position.

Right

A command to move the cursor given columns right.

SavePos

A command to save the cursor position.

ScrollDown

A command to scroll the terminal given rows down.

ScrollUp

A command to scroll the terminal given rows up.

SetAttr

A command to set the text attribute.

SetBg

A command to set the background color.

SetFg

A command to set the foreground color.

SetSize

A command to set the terminal size (rows, columns).

Show

A command to show the cursor.

StyledObject

A styled object.

SyncReader

A synchronous input reader (blocking).

Terminal

A terminal.

TerminalColor

A terminal color.

TerminalCursor

A terminal cursor.

TerminalInput

A terminal input.

Up

A command to move the cursor given rows up.

Enums

Attribute

Represents an attribute.

ClearType

Represents different options how to clear the terminal.

Color

Represents a color.

Colored

Represents a foreground or a background color.

ErrorKind

Wrapper for all errors that can occur in crossterm.

InputEvent

Represents an input event.

KeyEvent

Represents a key or a combination of keys.

MouseButton

Represents a mouse button/wheel.

MouseEvent

Represents a mouse event.

Traits

Colorize

Provides a set of methods to set the colors.

Command

A command is an action that can be performed on the terminal.

ExecutableCommand

A trait that defines behaviour for a command that will be executed immediately.

IntoRawMode

Allows to enable raw mode.

QueueableCommand

A trait that defines behaviour for a command that can be used to be executed at a later time point. This can be used in order to get more performance.

Styler

Provides a set of methods to set the text attributes.

Functions

color

Creates a new TerminalColor.

cursor

Creates a new TerminalCursor.

input

Creates a new TerminalInput.

style

Creates a StyledObject.

terminal

Creates a new Terminal.

Type Definitions

Result

The crossterm result type.