Skip to content

Instantly share code, notes, and snippets.

View fifo.rs
use std::default::Default;
struct Fifo<T> {
buffer: [T; BUFFER_SIZE],
windex: Index,
rindex: Index,
}
impl<T: Default + Copy> Fifo<T> {
fn new() -> Fifo<T> {
View gist:6f252c256d11d2cb78f6
src/main.rs:126:23: 126:86 error: mismatched types:
expected `*const libc::types::common::c95::c_void`,
found `*const libc::types::common::c95::c_void`
(expected enum `libc::types::common::c95::c_void`,
found a different enum `libc::types::common::c95::c_void`) [E0308]
@simias
simias / triangle.rs
Created Feb 9, 2015
Example program for gl-rs + rust-sdl2
View triangle.rs
// Copyright 2013 The gl-rs developers. For a full listing of the authors,
// refer to the AUTHORS file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
View gist:6f23ed95af7a8c8240b8
int foo() {
return 0;
}
int bar(void) {
return 0;
}
int main() {
foo(42);
View gist:cdd520b5db9308fb02d9
Compiling rustbook v0.3.0 (file:///home/simias/src/rustbook)
src/main.rs:13:1: 13:18 error: unstable feature
src/main.rs:13 #![feature(core)]
^~~~~~~~~~~~~~~~~
note: this feature may not be used in the beta release channel
src/main.rs:14:1: 14:25 error: unstable feature
src/main.rs:14 #![feature(exit_status)]
^~~~~~~~~~~~~~~~~~~~~~~~
note: this feature may not be used in the beta release channel
src/main.rs:15:1: 15:21 error: unstable feature
View gist:756db24070d79112a959
src/main.rs:22:31: 22:35 error: cannot borrow `*self` as mutable more than once at a time
src/main.rs:22 while let Some(msg) = self.next_packet() {
^~~~
src/main.rs:22:31: 22:35 note: previous borrow of `*self` occurs here; the mutable borrow prevents subsequent moves, borrows, or modification of `*self` until the borrow ends
src/main.rs:22 while let Some(msg) = self.next_packet() {
^~~~
View gist:51a8b1f26c27b604b6ec
#![feature(no_std,core)]
#![no_std]
#![crate_type = "staticlib"]
#![feature(lang_items)]
extern crate core;
fn main() {
}
View gist:e65feefce18b0f5ee256
#![feature(lang_items)]
#![feature(no_std,core)]
#![no_std]
#![crate_type = "staticlib"]
extern crate core;
// Various lang items required by rustc
#[lang = "stack_exhausted"]
extern fn stack_exhausted() {}
View gist:fcd543037dab4ebd7256
OBJS = genplus-ntsc-md.o md_ntsc.o
NTSC_VARIANT = NTSC_COMPOSITE
CFLAGS = -fPIC -O2 -D$(NTSC_VARIANT)
all: genplus-ntsc.so genplus-ntsc.a
genplus-ntsc.so: $(OBJS)
$(CC) -shared -o $@ $(OBJS)
View gist:e31e5e4346ca6969fb20
impl GdbRemote {
fn send_reply(&mut self, reply: Reply) -> Result<(), ()> {
match self.remote.write(&reply.into_packet()) {
//...
}
}
}
impl Reply {
pub fn into_packet(mut self) -> Vec<u8> {