Skip to content

Instantly share code, notes, and snippets.

@shadowmint
Created April 24, 2014 02:08
Show Gist options
  • Save shadowmint/11239084 to your computer and use it in GitHub Desktop.
Save shadowmint/11239084 to your computer and use it in GitHub Desktop.
macro_rules! trace(
($($arg:tt)*) => (
{ let x = ::std::io::stdout().write_line(format_args!(::std::fmt::format, $($arg)*)); println!("{}", x); }
);
)
pub fn do_something() -> uint {
return 99;
}
struct Blah<'a> {
x:&'a fn() -> uint
}
#[test]
fn test_this_thing() {
let x = Blah { x: &do_something };
let y = (*x.x)();
trace!("{}", y);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment