Skip to content

Instantly share code, notes, and snippets.

@dbp
Created August 23, 2012 21:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbp/3442506 to your computer and use it in GitHub Desktop.
Save dbp/3442506 to your computer and use it in GitHub Desktop.
macro
macro_rules! num_visitor(
($typ:ident) => (
fn visit_$typ() -> bool {
self.align_to::<$typ>();
do self.get::<$typ>() |i| {
self.out += $typ::to_str(i, 10u);
};
self.bump_past::<$typ>();
true
}
);
)
impl fmt_visitor: ty_visitor {
...
num_visitor!(i8);
...
}
error message:
fmt.rs:112:4: 112:15 error: unexpected token: `num_visitor`
fmt.rs:112 num_visitor!(i8);
^~~~~~~~~~~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment