[go: up one dir, main page]

[][src]Macro anes::queue

macro_rules! queue {
    ($dst:expr, $($sequence:expr),* $(,)?) => { ... };
}

Queues ANSI escape sequence(s).

What does queue mean exactly? All sequences are queued with the write!($dst, "{}", $sequence) macro without calling the flush method.

Check the execute! macro if you'd like execute them immediately (call the flush method after all sequences were queued).

Examples

use std::io::{Result, Write};

use anes::queue;

fn main() -> Result<()> {
    let mut stdout = std::io::stdout();
    queue!(
        &mut stdout,
        anes::SaveCursorPosition,
        anes::MoveCursorTo(10, 10)
    )?;

    queue!(&mut stdout, anes::RestoreCursorPosition,)?;

    // ANSI sequences are not executed until you flush it!
    stdout.flush()
}