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; |
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
| #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
| 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 <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
| SHELL=/bin/bash | |
| TARGET := arm-linux-noeabi | |
| CHIP := arm926ej-s | |
| rpi: CHIP := arm1176jzf-s | |
| GCC_PREFIX := $(GCC_PREFIX)arm-none-eabi- | |
| RUSTC := $(RUST_ROOT)/bin/rustc | |
| #RUSTCFLAGS := -O --target $(TARGET) -Z no-landing-pads -Z debug-info -Z extra-debug-info --cfg $(CHIP) |
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
| #!/bin/bash | |
| mkdir bc | |
| mkdir bclink | |
| git clone git@github.com:thestinger/rust-core | |
| rustc --emit=bc --out-dir=bc rust-core/core/lib.rs | |
| rustc --emit=bc,link --out-dir=bclink rust-core/core/lib.rs | |
| diff bc/core.bc bclink/core.bc |
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 "minheap.h" | |
| /* Default constructor */ | |
| minheap::minheap() | |
| { | |
| // Ensure that there is always an empty element at index 0 | |
| values.push_back(0); | |
| }; | |
| void minheap::insert(int v) |
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
| // For chasecaleb of #xkcd. Untested- use at your own risk! | |
| // I took this on just as a challange, so please review / check against your own work. | |
| #define PACKET_DATA_SZ 22 | |
| #define SAMPLE_BITS 10 | |
| typedef struct { | |
| uint32_t timestamp; | |
| char data[PACKET_DATA_SZ]; | |
| } sample_packet_t; |
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
| # after having run `$ gcloud compute disks create --size=2GB gce-nfs-disk` | |
| apiVersion: v1 | |
| kind: PersistentVolume | |
| metadata: | |
| name: nfs-pv | |
| labels: | |
| app: test | |
| spec: | |
| capacity: | |
| storage: 2Gi |
OlderNewer