Skip to content

Instantly share code, notes, and snippets.

View jaredonline's full-sized avatar

Jared McFarland jaredonline

View GitHub Profile
impl<R: Monster> MonsterCreator for R {
fn new(life: int) -> R {
R { life: life, strength: 35, charisma: 91, weapon: 2, name:
"Industrial Raver Monkey".to_str() }
}
}
use std::io;
use std::rand::Rng;
struct Monster {
strength: int,
life: int,
charisma: int,
weapon: int,
name: String
}
@jaredonline
jaredonline / makefile-osx
Created August 21, 2014 02:32
Makefile for OS X Mavericks for libtcod
# libtcod makefile
# to build debug version, run "make -f makefile-linux debug"
# to build release version, run "make -f makefile-linux release"
SRCDIR=src
INCDIR=include
#dependencies
# SDL
SDL_FLAGS=`sdl-config --cflags`
SDL_LIBS=`sdl-config --libs`
pub struct Game<'a> {
pub exit: bool,
pub window_bounds: Bound,
pub rendering_component: Box<RenderingComponent>,
pub stats_window: Box<WindowComponent>,
pub map_window: Box<WindowComponent>,
pub input_window: Box<WindowComponent>,
pub messages_window: Box<WindowComponent>
}
structs.rs:48:23: 48:28 error: mismatched types: expected `Box<State+'a>`, found `Box<BadState>` (expected trait State, found struct BadState)
structs.rs:48 self.state = state;
^~~~~
error: aborting due to previous error
[30-Sep-2014 14:22:10 EST5EDT] [x1oRjQFVyc6LgPAHVwDD4re8KsPZ] [error] [API] [/home/jmcfarland/development/Etsyweb/phplib/Api/ErrorHandler.php:142] [0] Cannot access empty property in /home/jmcfarland/development/Etsyweb/phplib/Feed/Story.php on line 83
Compiling http v0.1.0-pre (https://github.com/chris-morgan/rust-http.git#3f442dee)
src/http/client/sslclients/openssl.rs:22:27: 22:51 error: this function takes 2 parameters but 1 parameter was supplied [E0061]
src/http/client/sslclients/openssl.rs:22 let stream = try!(TcpStream::connect(addr));
^~~~~~~~~~~~~~~~~~~~~~~~
<std macros>:1:1: 8:2 note: in expansion of try!
src/http/client/sslclients/openssl.rs:22:22: 22:53 note: expansion site
src/http/server/mod.rs:29:34: 29:72 error: this function takes 2 parameters but 1 parameter was supplied [E0061]
src/http/server/mod.rs:29 let mut acceptor = match TcpListener::bind(config.bind_address).listen() {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/http/server/mod.rs:136:33: 136:71 error: this function takes 2 parameters but 1 parameter was supplied [E0061]
Compiling dwemthys v0.0.1 (file:///Users/jmcfarland/code/rust/dwemthys)
/Users/jmcfarland/code/rust/dwemthys/src/actor.rs:22:18: 22:53 error: cannot infer an appropriate lifetime for autoref due to conflicting requirements
/Users/jmcfarland/code/rust/dwemthys/src/actor.rs:22 let mc = self.movement_component.box_clone();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/jmcfarland/code/rust/dwemthys/src/actor.rs:22:18: 22:41 note: first, the lifetime cannot outlive the expression at 22:17...
/Users/jmcfarland/code/rust/dwemthys/src/actor.rs:22 let mc = self.movement_component.box_clone();
^~~~~~~~~~~~~~~~~~~~~~~
/Users/jmcfarland/code/rust/dwemthys/src/actor.rs:22:18: 22:41 note: ...so that auto-reference is valid at the time of borrow
/Users/jmcfarland/code/rust/dwemthys/src/actor.rs:22 let mc = self.movement_component.box_clone();
src/game.rs:110:32: 110:61 error: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements
src/game.rs:110 self.game_state.render(&mut self.rendering_component, &mut self.maps, &mut self.windows);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/game.rs:110:32: 110:61 note: first, the lifetime cannot outlive the expression at 110:31...
src/game.rs:110 self.game_state.render(&mut self.rendering_component, &mut self.maps, &mut self.windows);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/game.rs:110:32: 110:61 note: ...so that reference is valid at the time of borrow
src/game.rs:110 self.game_state.render(&mut self.rendering_component, &mut self.maps, &mut self.windows);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/game.rs:110:9: 110:97 note: but, the lifetime must be valid for the method call at 110:8...
#![feature(core)]
extern crate rand;
extern crate core;
use std::sync::{Arc, Mutex};
use std::thread;
use std::fmt::{Display, Formatter, Result};
use core::ops::Deref;