Created
August 23, 2012 21:58
-
-
Save dbp/3442506 to your computer and use it in GitHub Desktop.
macro
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_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