Struct minus::Pager[][src]

pub struct Pager {
    pub lines: String,
    pub prompt: String,
    pub data_finished: bool,
    pub input_handler: Box<dyn InputHandler + Send + Sync>,
    // some fields omitted
}

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

Fields

lines: String

The output that is displayed

prompt: String

The prompt displayed at the bottom

data_finished: boolinput_handler: Box<dyn InputHandler + Send + Sync>

Implementations

impl Pager[src]

#[must_use]
pub fn new() -> Self
[src]

Initialize a new pager configuration

Example

let pager = minus::Pager::new();

pub fn set_text(self, t: impl Into<String>) -> Self[src]

Set the output text to this t Example

let pager = minus::Pager::new().set_text("This is a line");

#[must_use]
pub fn set_line_numbers(self, l: LineNumbers) -> Self
[src]

Set line number to this setting

Example

use minus::{Pager, LineNumbers};

let pager = Pager::new().set_line_numbers(LineNumbers::Enabled);

pub fn set_prompt(self, t: impl Into<String>) -> Self[src]

Set the prompt displayed at the prompt to t

Example

use minus::Pager;

let pager = Pager::new().set_prompt("my awesome program");

#[must_use]
pub fn set_searchable(self, s: bool) -> Self
[src]

Sets whether searching is possible inside the pager. Default s set to true

Example

use minus::Pager;

let pager = Pager::new().set_searchable(false);

This is a candidate for deprecation. If you want to enable search, enable the search feature. This is because this dosen’t really give any major benifits since regex and all related functions are already compiled

#[must_use]
pub fn set_page_if_havent_overflowed(self, p: bool) -> Self
[src]

Sets whether the pager actually blocks UI if our data is finished, and we havent overflowed the page

Example

use minus::Pager;

let pager = Pager::new().set_page_if_havent_overflowed(false);

#[must_use]
pub fn finish(self) -> Arc<PagerMutex>
[src]

Return a PagerMutex from this Pager. This is gated on tokio_lib or async_std_lib feature

Example

use minus::Pager;

let pager = Pager::new().set_text("This output is paged").finish();

#[must_use]
pub fn set_exit_strategy(self, strategy: ExitStrategy) -> Self
[src]

Set the default exit strategy.

This controls how the pager will behave when the user presses q or Ctrl+C See ExitStrategy for available options

#[must_use]
pub fn set_input_handler(
    self,
    input_handler: Box<dyn InputHandler + Send + Sync>
) -> Self
[src]

Set the InputHandler that maps from crossterm input events to minuses internal events, this allows custom keybindings

pub fn data_finished(&mut self)[src]

Indicate to the pager that the data has finished. This is currently only used by the async runtimes.

pub fn exit(&mut self)[src]

Indicate to the pager that we want to exit

pub fn add_exit_callback<F>(&mut self, callback: F) where
    F: FnMut() + Send + Sync + 'static, 
[src]

Add a callback to be run when the pager has finished

pub fn run_exit_callbacks(&mut self)[src]

Run callbacks that want to be run on exit

Trait Implementations

impl Default for Pager[src]

Auto Trait Implementations

impl !RefUnwindSafe for Pager

impl Send for Pager

impl Sync for Pager

impl Unpin for Pager

impl !UnwindSafe for Pager

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.