1 | /// An example how to queue & flush the ANSI escape sequence. |
---|---|
2 | use std::io::{Result, Write}; |
3 | |
4 | use anes::queue; |
5 | |
6 | fn main() -> Result<()> { |
7 | let mut stdout = std::io::stdout(); |
8 | queue!( |
9 | &mut stdout, |
10 | anes::SaveCursorPosition, |
11 | anes::MoveCursorTo(10, 10) |
12 | )?; |
13 | |
14 | queue!(&mut stdout, anes::RestoreCursorPosition,)?; |
15 | |
16 | // ANSI sequences are not executed until you flush it! |
17 | stdout.flush() |
18 | } |
19 |