Skip to content

Instantly share code, notes, and snippets.

View bvssvni's full-sized avatar

Sven Nilsen bvssvni

View GitHub Profile
@bvssvni
bvssvni / code
Last active August 29, 2015 14:01
impl ::std::fmt::Show for Event {
fn fmt(&self, out: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
out.write_str(match *self {
NoEvent => "NoEvent",
QuitEvent(..) => "QuitEvent",
AppTerminatingEvent(..) => "AppTerminatingEvent",
...
use graphics::{
Context,
};
use {
AssetStore,
GameWindow,
Gl,
};
use keyboard;
use mouse;
/// Updates the cursor that tracks an event.
///
/// Returns `None` if the action did not terminate.
/// or `Some(dt)` that tells how much time was consumed by the action.
pub fn update(
&mut self,
dt: f64,
f: |action: &'a A, state: S| -> Option<S>
) -> Option<f64> {
match *self {
src/gen/main.rs:324:17: 324:80 error: invalid format string: expected `}` but found `{`
src/gen/main.rs:324 "\\#[inline] pub {}fn {}({}){} \\{ {}(storage::{}.f)({}){} \\}",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/gl/lib.rs:1939:57: 1939:66 error: cannot transmute to a type that contains type parameters
src/gl/lib.rs:1939 std::option::Some(p) => FnPtr { f: unsafe { transmute(p) }, is_loaded: true },
^~~~~~~~~
#!/bin/sh
# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.
$ make examples COMPILER_FLAGS="-O --cfg port_audio"
--- Type 'make test' to test library
error: linking with `cc` failed: exit code: 1
note: cc '-m64' '-L' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib' '-o' 'examples/audio' 'examples/audio.o' '-lmorestack' '-nodefaultlibs' '-Wl,-dead_strip' '/Users/sven/Desktop/piston/target/x86_64-apple-darwin/lib/libpiston-a1b791b5-0.0.rlib' '/Users/sven/Desktop/opensource/gl-rs/target/x86_64-apple-darwin/lib/libgl-8febb75e-0.1.rlib' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib/libtime-4bb3739b-0.11.0-pre.rlib' '/Users/sven/Desktop/opensource/glfw-rs/target/x86_64-apple-darwin/lib/libglfw-38369174-0.1.rlib' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib/libsemver-e49a2dee-0.11.0-pre.rlib' '/Users/sven/Desktop/opensource/rust-portaudio/lib/libportaudio-896aa06e-0.1.rlib' '/Users/sven/Desktop/rust-graphics/target/x86_64-apple-darwin/lib/libgraphics-587c2edd-0.0.rlib' '/usr/local/lib/rustlib/x86_64-apple-darwin/lib/libnative-1fb5e2c0-0.11.0-pre.rlib' '/usr/local/lib/ru
pub struct Per<A, B>(f64);
impl<T> Per<u8, T> {
pub fn bytes(num: f64) -> Per<u8, T> {
Per(num)
}
pub fn kibi_bytes(num: f64) -> Per<u8, T> {
Per(num * 1024.0)
}
#version 330
in vec4 a_v4Position;
in vec4 a_v4FillColor;
in vec2 a_v2TexCoord;
uniform sampler2D s_texture;
out vec2 v_v2TexCoord;
out vec4 v_v4FillColor;
@bvssvni
bvssvni / error
Last active August 29, 2015 14:03
src/main.rs:108:17: 108:18 error: `d` does not live long enough
src/main.rs:108 let d = d.trans(10.0, 10.0);
^
src/main.rs:104:11: 117:2 note: reference must be valid for the block at 104:10...
src/main.rs:104 fn main() {
src/main.rs:105 let c = Context::new();
src/main.rs:106 {
src/main.rs:107 let d = c.trans(20.0, 40.0);
src/main.rs:108 let d = d.trans(10.0, 10.0);
src/main.rs:109 let transform = d.transform.get();