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
| #include <cstdio> | |
| #include <vector> | |
| int main(){ | |
| int new_size = 3; |
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 self::arm1176jzf_s::gpio::pin_mode::OUTPUT; | |
| // Compilation error: cannot import from a trait or type implementation | |
| pub mod arm1176jzf_s; | |
| // Defined with submodules in separate file | |
| pub fn init() { | |
| let p : Pin = arm1176jzf_s::gpio::Pin::get(16); | |
| p.setMode(OUTPUT); | |
| // setMode has a single parameter of type arm1176jzf_s::gpio::pin_mode; OUTPUT is a variant thereof |
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
| #include <stdio.h> | |
| int i = 0; // Static values are initialized to 0 according to C spec, this just makes it explicit | |
| int foo(){ | |
| i = i + 1; | |
| return i; | |
| } | |
| int main(){ |
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
| trait ScreenCanvas{ | |
| fn sync(&Self) -> bool; | |
| fn setResolution(&Self) -> bool; | |
| } | |
| struct screen_buffer_info{ | |
| x : uint; | |
| } | |
| impl ScreenCanvas for screen_buffer_info{ |
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
| gist.rs:12:5: 16:6 error: method `add` is not a member of trait `vector<A>` | |
| gist.rs:12 fn add(&self, rhs : &(A,A,A)) -> (A,A,A){ | |
| gist.rs:13 let (x,y,z) = *self; | |
| gist.rs:14 let (a,b,c) = *rhs; |
NewerOlder