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
| 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 | |
| } |
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 bytes : ~[u8] = ~[1,1,1]; // for example | |
| let len = vec::len(bytes)-1; | |
| let mut out: u32 = 0; | |
| do vec::iteri(bytes) |i, b| { | |
| out += (b as u32) << (8*(len-i)) | |
| } | |
| io::println(u32::str(out)); | |
| } |
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
| // how pretty printer formats closures (I think; I'm unable to build from incoming right now to check) | |
| fn main() { | |
| do something |foo| | |
| { | |
| something_long_enough_to_not; | |
| fit_on_a_single_line; | |
| } | |
| let my_fn = || | |
| { | |
| something_long_enough_to_not; |
NewerOlder