7 releases (4 breaking)

new 0.5.1 Dec 12, 2024
0.5.0 Aug 30, 2024
0.4.0 Aug 27, 2024
0.3.0 Jul 17, 2024
0.1.0 Mar 14, 2022

#163 in Command-line interface

Download history 548/week @ 2024-08-22 907/week @ 2024-08-29 529/week @ 2024-09-05 183/week @ 2024-09-12 274/week @ 2024-09-19 179/week @ 2024-09-26 158/week @ 2024-10-03 219/week @ 2024-10-10 329/week @ 2024-10-17 193/week @ 2024-10-24 103/week @ 2024-10-31 293/week @ 2024-11-07 221/week @ 2024-11-14 208/week @ 2024-11-21 228/week @ 2024-11-28 171/week @ 2024-12-05

891 downloads per month
Used in menu

MPL-2.0 license

140KB
3.5K SLoC

Pipeline Crates.io API reference

noline

Noline is an IO-agnostic #[no_std] line editor providing robust line editing for any system. The core functionality is IO-free, so it can be adapted to any system be it embedded, async, async embedded, WASM or IPoAC (IP over Avian Carriers).

Features:

  • IO-free
  • Minimal dependencies
  • No allocation needed - Both heap-based and static buffers are provided
  • UTF-8 support
  • Emacs keybindings
  • Line history

Possible future features:

  • Auto-completion and hints

The API should be considered experimental and will change in the future.

The core implementation consists of a state machine taking bytes as input and yielding iterators over byte slices. Because this is done without any IO, Noline can be adapted to work on any platform.

Noline comes with multiple implemenations:

Editors can be built using builder::EditorBuilder.

Example

let prompt = "> ";

let mut io = MyIO {}; // IO handler, see full examples for details
                      // how to implement it

let mut editor = EditorBuilder::new_unbounded()
    .with_unbounded_history()
    .build_sync(&mut io)
    .unwrap();

while let Ok(line) = editor.readline(prompt, &mut io) {
    writeln!(io, "Read: '{}'", line).unwrap();
}

For more details, see docs.

Usage

Add this to your Cargo.toml:

[dependencies]
noline = "0.5.1"

License

MPL-2.0

Dependencies

~285–730KB
~17K SLoC