ratatui

Function try_restore

source
pub fn try_restore() -> Result<()>
Available on crate feature crossterm only.
Expand description

Restore the terminal to its original state.

This function will attempt to restore the terminal to its original state by performing the following steps:

  1. Raw mode is disabled.
  2. The alternate screen buffer is left.

If either of these steps fail, the error is returned.

Use restore instead of this function when you don’t need to handle the error yourself, as ignoring the error is generally the correct behavior when cleaning up before exiting. If you need to handle the error yourself, use this function instead.

§Examples

ratatui::try_restore()?;