Crate minus[][src]

Expand description

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

Modules

Provides error types that are used in various places

Provides the InputHandler trait, which can be used to customize the default keybindings of minus

Structs

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

Enums

Behaviour that happens when the pager is exitted

Enum indicating whether to display the line numbers or not.

Defines modes in which the search can run

Functions

async_std_updatingasync_std_lib

Run the pager inside an async_std task.

page_allstatic_output

Outputs static information.

Run the pager inside a tokio task.

Type Definitions

A convinience type for Vec<Box<dyn FnMut() + Send + Sync + 'static>>

PagerMutextokio_lib or async_std_lib

A convinience tyoe for std::sync::Arc<async_mutex::Mutex<Pager>>