Skip to main content

Module term

Module term 

Source
Expand description

A terminal, hand-rolled on libc.

The syscall half only. ratatui draws every row (see tui::rata), but none of its backends are linked: CrosstermBackend would add crossterm, mio, signal-hook and parking_lot to do what is already here, on a tree whose size (149 crates, 6.20 MiB) is a stated property of the product. So termios for raw mode, TIOCGWINSZ for the size, poll(2) for input, three sigactions to survive a resize and a kill, and Term::draw to put the rows on the screen. libc is already in the tree for statfs.

Unix only, which is the same bet mmap, SIGTERM and the filesystem guard already make.

StructsΒ§

Term

EnumsΒ§

Key
Parsed πŸ”’

ConstantsΒ§

BLUE
BOLD
CYAN
DIM
GREEN
MAGENTA
RED
RESET
REV
YELLOW

StaticsΒ§

ORIG πŸ”’
The terminal settings as they were before Term::enter.

FunctionsΒ§

bail πŸ”’ ⚠
Give the terminal back, then die.
csi πŸ”’
ok_or_errno πŸ”’
The termios calls’ contract: 0, or -1 and the reason is in errno.
on_signal πŸ”’
Install h for sig, without SA_RESTART.
parse πŸ”’
One key off the front of b, or Parsed::Need if what is there could still grow into a longer sequence.
poll_in πŸ”’
restore πŸ”’
Put the terminal back. Idempotent, because Drop, the panic hook and a fatal signal can all reach it and a double panic would otherwise run it twice.
take_one πŸ”’
winch πŸ”’ ⚠
A resize. Nothing to do in the handler β€” the delivery itself is the message, and it arrives as an EINTR in poll_in.