[−][src]Struct minus::Pager
A struct containing basic configurations for the pager. This is used by all initializing functions
Example
You can use any async runtime, but we are taking the example of tokio
#[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { use minus::{Pager, LineNumbers, tokio_updating}; let pager = Pager::new() .set_line_numbers(LineNumbers::AlwaysOn) .set_prompt("A complex configuration") .finish(); // Normally, you would use `futures::join` to join the pager and the text // updating function. We are doing this here to make the example simple tokio_updating(pager).await?; Ok(()) }
For static output
fn main() -> Result<(), Box<dyn std::error::Error>> { let pager = minus::Pager::new().set_text("Hello").set_prompt("Example"); minus::page_all(pager)?; Ok(()) }
Fields
lines: String
The output that is displayed
prompt: String
The prompt displayed at the bottom
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(mut self: 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(mut self: 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(mut self: 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(mut self: 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 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(mut self: 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
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Pager
[src]
impl Send for Pager
[src]
impl Sync for Pager
[src]
impl Unpin for Pager
[src]
impl UnwindSafe for Pager
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,