27 stable releases

Uses old Rust 2015

6.0.1 Jul 12, 2024
6.0.0 Mar 30, 2024
5.101.0 Feb 16, 2021
5.99.0 Feb 25, 2019
5.71.1 Feb 28, 2015

⚠️ Issues reported

#73 in Command-line interface

Download history 2352/week @ 2024-07-19 2014/week @ 2024-07-26 1863/week @ 2024-08-02 2909/week @ 2024-08-09 2076/week @ 2024-08-16 2120/week @ 2024-08-23 2340/week @ 2024-08-30 1982/week @ 2024-09-06 1785/week @ 2024-09-13 2195/week @ 2024-09-20 2011/week @ 2024-09-27 1232/week @ 2024-10-04 1402/week @ 2024-10-11 1655/week @ 2024-10-18 1880/week @ 2024-10-25 1939/week @ 2024-11-01

6,993 downloads per month
Used in 94 crates (31 directly)

MIT license

100KB
3K SLoC

Rust 2.5K SLoC // 0.0% comments C 327 SLoC // 0.1% comments

ncurses-rs Build Status

This is a very thin wrapper around the ncurses TUI lib.

NOTE: The ncurses lib is terribly unsafe and ncurses-rs is only the lightest wrapper it can be. If you want a safe and idiomatic TUI library for Rust, look elsewhere. If you want a 1:1 port of C to Rust or you want to crank a TUI out C-style in Rust, this will probably do the trick.

Building

The compiled library will go to the target directory.

cargo build

Note that you must to have the ncurses library installed and linkable for ncurses-rs to work. On Linux, this should be trivial. On OS X, consider installing ncurses using Homebrew. (Note that you have to force Homebrew to link the library to /usr/local/lib: brew link --force ncurses and set that path to LIBRARY_PATH environmental variable.)

Examples

Examples are built by cargo build. To run them, use cargo run --example ex_<NUMBER>. Example numbers increase along with the complexity of the example.

Current examples:
1. Hello World
2. Basic Input & Attributes
3. Simple Pager
4. Window Movement
5. Menu Library (requires rust nightly)
6. Pager & Syntax Highlighting
7. Basic Input & Attributes (Unicode)
8. Special ACS Characters

Environment variables

Some environment variables are read by build.rs:

If set, NCURSES_RS_RUSTC_LINK_LIB will be used for NCURSES_RS_RUSTC_LINK_LIB.

If set, NCURSES_RS_RUSTC_FLAGS will be used for cargo:rustc-flags.

If set, NCURSES_RS_CFLAGS will be used for the compilation of the test program chtype_size.c.

Dependencies

~0.4–330KB