Created
October 26, 2012 00:48
-
-
Save erickt/3956374 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
use to_str::ToStr; | |
macro_rules! map_cast( | |
($ty:ident, ~[$($arg:expr),+]) => ( | |
~[$($arg as $ty),+] | |
) | |
) | |
fn main() { | |
let xs: ~[ToStr] = map_cast!(ToStr, ~[1, 2.5]); | |
io::println(fmt!("%?", xs.map(|x| x.to_str()))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment