[][src]Struct crossterm_screen::AlternateScreen

pub struct AlternateScreen { /* fields omitted */ }

An alternate screen.

With this type, you will be able to switch to the alternate screen and then back to the main screen.

Be aware that you'll be switched back to the main screen when you drop the AlternateScreen value.

It's recommended to use the command API. See the EnterAlternateScreen and LeaveAlternateScreen commands documentation for more info.

Examples

Alternate screen with raw mode enabled:

use crossterm_screen::AlternateScreen;
use crossterm_utils::Result;

fn main() -> Result<()> {
    let _alternate = AlternateScreen::to_alternate(true)?;

    // Do something on the alternate screen in the raw mode

    Ok(())
} // `_alternate` dropped here <- raw mode disabled & back to main screen

Methods

impl AlternateScreen[src]

pub fn to_alternate(raw_mode: bool) -> Result<AlternateScreen>[src]

Switches to the alternate screen.

Arguments

  • raw_mode - true enables the raw mode as well

Notes

You'll be automatically switched to the main screen if this function fails.

pub fn to_main(&self) -> Result<()>[src]

Switches to the main screen.

Trait Implementations

impl Drop for AlternateScreen[src]

Auto Trait Implementations

Blanket Implementations

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

impl<T> From<T> for 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.

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

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

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