Skip to content

Instantly share code, notes, and snippets.

@krdln
Created October 30, 2013 01:06
Show Gist options
  • Save krdln/7225579 to your computer and use it in GitHub Desktop.
Save krdln/7225579 to your computer and use it in GitHub Desktop.
use std::rt::io::Writer;
use std::rt::io::stdio::with_task_stdout;
struct MagicWriter();
impl Writer for MagicWriter {
fn write(&mut self, buf: &[u8]) {
do with_task_stdout |o| { o.write(buf); }
}
fn flush(&mut self) {
do with_task_stdout |o| { o.flush(); }
}
}
fn stdout() -> MagicWriter { MagicWriter }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment