Crate minus[][src]

A fast, asynchronous terminal paging library for Rust. minus provides high level functionalities to easily write a pager for any terminal application. Due to the asynchronous nature of minus, the pager's data can be updated (this needs the correct feature to be enabled).

minus supports both tokio as well as async-std runtimes. What's more, if you only want to use minus for serving static output, you can simply opt out of these dynamic features, see the Features section below.

Why this crate ?

minus was started by me for my work on pijul. I was unsatisfied with the existing options like pager and moins.

  • pager:

    • Only provides functions to join the standard output of the current program to the standard input of external pager like more or less.
    • Due to this, to work within Windows, the external pagers need to be packaged along with the executable.
  • moins:

    • The output could only be defined once and for all. It is not asynchronous and does not support updating.

The main goals of minus are to be very compact and as configurable as possible.

  • minus provides a lot of configurablity to the end-application and this configuration can be defined not just in compile-time but also in runtime. Your entire configuration like the output displayed, prompt and line numbers are inside a Arc<Mutex>, which means at any time you can lock the configuration, change something, and voila minus will automatically update the screen

  • When using minus, you select what features you need and nothing else. See Features below

Features

  • async_std_lib: Use this if you use async_std runtime in your application
  • tokio_lib:Use this if you are using tokio runtime for your application
  • static_output: Use this if you only want to use minus for displaying static output
  • search: If you want searching capablities inside the feature

Structs

Pager

A struct containing basic configurations for the pager. This is used by all initializing functions

PagerGuard

A sort of a MutexGuard similar to std::sync::MutexGuard.

PagerMutex

A sort of a mutex that holds the pager

RegexError

There was an error while compiling the regex

TermError

An operation on the terminal failed, for example resizing it.

Enums

AlternateScreenPagingError

Errors that can happen while running

CleanupError

Errors that can occur during clean up

ExitStrategy

Behaviour that happens when the pager is exitted

LineNumbers

Enum indicating whether to display the line numbers or not.

SetupError

Errors that can occur during setup

Functions

async_std_updating

Run the pager inside an async_std task.

page_all

Outputs static information.

tokio_updating

Run the pager inside a tokio task.