tinycrossterm 0.1.0

Minimal, feature-gated, WASM-compatible subset of crossterm
Documentation
/// Queues one or more commands for later execution.
///
/// Writes the ANSI representation of each command to the given writer
/// without flushing. Call `flush()` on the writer to execute.
#[macro_export]
macro_rules! queue {
    ($writer:expr $(, $command:expr)* $(,)?) => {{
        use $crate::Command as _;
        let w = &mut $writer;
        let result: std::io::Result<()> = (|| {
            $(
                $command.write_ansi(w)?;
            )*
            Ok(())
        })();
        result
    }};
}

/// Executes one or more commands immediately.
///
/// Writes the ANSI representation of each command to the given writer
/// and flushes.
#[macro_export]
macro_rules! execute {
    ($writer:expr $(, $command:expr)* $(,)?) => {{
        use std::io::Write as _;
        use $crate::Command as _;
        let w = &mut $writer;
        let result: std::io::Result<()> = (|| {
            $(
                $command.write_ansi(w)?;
            )*
            w.flush()?;
            Ok(())
        })();
        result
    }};
}