Last active
January 10, 2022 11:03
-
-
Save dgellow/87b68992fdf1509b3f758fbd264cf3fe to your computer and use it in GitHub Desktop.
A simple Rust macro display!() that combines println!() and std::io::stdout::flush()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[macro_export] | |
macro_rules! display { | |
( $($t:tt)* ) => { | |
{ | |
use std::io::Write; | |
let mut out = std::io::stdout(); | |
write!(out, $($t)* ).unwrap(); | |
write!(out, "\n").unwrap(); | |
out.flush().unwrap(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment