1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#[cfg(feature = "crossterm")]
mod _impl {
    pub use crossterm::cursor::MoveUp;
    pub use crossterm::cursor::{Hide, Show};
}
#[cfg(feature = "crossterm")]
pub use _impl::*;

#[cfg(feature = "crossterm")]
#[macro_export]
macro_rules! execute {
    ($writer:expr $(, $command:expr)* $(,)? ) => {
        $crate::crossterm::queue!($writer $(, $command)*).and_then(|()| {
            $writer.flush().map_err($crate::crossterm::ErrorKind::IoError)
        }).map_err($crate::crossterm_utils::into_io_error)
    }
}

#[cfg(all(feature = "termion", not(feature = "crossterm")))]
#[macro_export]
macro_rules! execute {
    ($writer:expr $(, $command:expr)* $(,)? ) => {
        Ok(()) $(
            .and_then(|()| write!($writer, "{}", $command))
        )*.and_then(|_| $writer.flush())
    }
}

#[cfg(all(feature = "termion", not(feature = "crossterm")))]
mod _impl {
    pub use termion::cursor::Up as MoveUp;
    pub use termion::cursor::{Hide, Show};
}
#[cfg(all(feature = "termion", not(feature = "crossterm")))]
pub use _impl::*;