minicrossterm/crossterm_screen/src/sys/unix.rs
2019-09-18 19:31:12 +02:00

23 lines
516 B
Rust

use crossterm_utils::Result;
/// This command is used for enabling and disabling raw mode for the terminal.
pub struct RawModeCommand;
impl RawModeCommand {
pub fn new() -> Self {
RawModeCommand
}
/// Enables raw mode.
pub fn enable(&mut self) -> Result<()> {
crossterm_utils::sys::unix::into_raw_mode()?;
Ok(())
}
/// Disables raw mode.
pub fn disable(&mut self) -> Result<()> {
crossterm_utils::sys::unix::disable_raw_mode()?;
Ok(())
}
}