summaryrefslogtreecommitdiffstats
path: root/vendor/anes/examples/queue.rs
blob: 0b2c7120d19f7bc6dbb99ff581010f5f126ce489 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/// An example how to queue & flush the ANSI escape sequence.
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()
}