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
RUSTC ?= rustc | |
#LOG_FLAGS ?= RUST_LOG=rustc::metadata::creader | |
all: glhex | |
run: all | |
./glhex | |
glhex: main.rs *.rs |
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( | |
(~[$($elems:expr),+] -> $T:ty) => (~[$($elems as $T),+]); | |
(@[$($elems:expr),+] -> $T:ty) => (@[$($elems as $T),+]); | |
($arr:expr -> $T:ty) => ($arr.map(|a| *a as $T)); | |
) | |
fn main() { | |
let arr1 = map_cast!(~[1, 2.5] -> ToStr); |
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
fn main() { | |
let stuff = ~[~"one", ~"two", ~"three"]; | |
stuff | |
.map(|s| str::append(~"lol", *s)) | |
.map(|s| io::println(*s)); | |
} |
NewerOlder