Skip to content

Instantly share code, notes, and snippets.

@erickt
Created October 26, 2012 00:48
Show Gist options
  • Save erickt/3956374 to your computer and use it in GitHub Desktop.
Save erickt/3956374 to your computer and use it in GitHub Desktop.
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