pub enum ExitStrategy {
RestoreConsole,
PrintContent(Vec<String>),
}Expand description
Strategy for exiting the application
Variants§
RestoreConsole
Restore the original terminal content
Simply exits the alternate screen without printing anything. The terminal will show whatever was displayed before the app started.
PrintContent(Vec<String>)
Print content to stdout on exit
Clears the screen and prints the provided lines.
Implementations§
Source§impl ExitStrategy
impl ExitStrategy
Sourcepub fn execute(&self) -> Result<()>
pub fn execute(&self) -> Result<()>
Execute the exit strategy
This should be called after:
- Disabling raw mode
- Leaving alternate screen
- Disabling mouse capture
It handles the final output based on the chosen strategy.
Sourcepub fn print_content(lines: &[String]) -> Self
pub fn print_content(lines: &[String]) -> Self
Create a PrintContent strategy from a slice of strings
Sourcepub fn print_content_iter<I, S>(lines: I) -> Self
pub fn print_content_iter<I, S>(lines: I) -> Self
Create a PrintContent strategy from an iterator
Trait Implementations§
Source§impl Clone for ExitStrategy
impl Clone for ExitStrategy
Source§fn clone(&self) -> ExitStrategy
fn clone(&self) -> ExitStrategy
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ExitStrategy
impl RefUnwindSafe for ExitStrategy
impl Send for ExitStrategy
impl Sync for ExitStrategy
impl Unpin for ExitStrategy
impl UnwindSafe for ExitStrategy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more