Skip to content

Instantly share code, notes, and snippets.

Aaron Miller AaronM04

  • Orange County, CA
View GitHub Profile
View Cargo.toml
[package]
name = "filefuture"
version = "0.1.0"
authors = ["you"]
edition = "2018"
[dependencies]
futures = "*"
@AaronM04
AaronM04 / wow.rs
Created Feb 24, 2019
Rust does not compare function argument types when determining which trait's implementation to use
View wow.rs
/// Won't compile:
///
/// $ rustc wow.rs
/// error[E0034]: multiple applicable items in scope
/// --> wow.rs:33:9
/// |
/// 33 | foo.wow("TSecond is str");
/// | ^^^ multiple `wow` found
/// |
/// note: candidate #1 is defined in an impl of the trait `TFirst` for the type `Foo`
@AaronM04
AaronM04 / linked_list.rs
Last active Feb 25, 2019 — forked from codesections/linked_list.rs
A simple linked list implemented in Rust
View linked_list.rs
#[derive(Debug)]
pub struct LinkedList {
head: Option<Box<Node>>,
tail: Option<*mut Node>,
}
#[derive(Debug)]
struct Node {
value: i32,
next: Option<Box<Node>>,
}
@AaronM04
AaronM04 / bitgrid_iter.rs
Last active Jun 26, 2018
testing BitGrid iterators
View bitgrid_iter.rs
// testing bit grid iterators
// $ cargo test
type BitGrid = Vec<Vec<u64>>;
fn new_bitgrid(width_in_words: usize, height: usize) -> BitGrid {
assert!(width_in_words != 0);
assert!(height != 0);
let mut result: BitGrid = Vec::new();
@AaronM04
AaronM04 / thread_pool.rb
Created Jan 8, 2018
Simple Ruby thread pool
View thread_pool.rb
class ThreadPool
def initialize(num_threads)
@tasks = Queue.new # contains either blocks to run, or :terminate
@threads = []
@terminated = false # only used to stop new work from being enqueued
num_threads.times do
@threads << Thread.new{ process }.run
end
end
@AaronM04
AaronM04 / astroblasto_line595.rs
Created Dec 15, 2017
astroblasto for 0.2 branch -- compare rustc stable vs nightly
View astroblasto_line595.rs
//! An Asteroids-ish example game to show off ggez.
//! The idea is that this game is simple but still
//! non-trivial enough to be interesting.
extern crate ggez;
extern crate rand;
use ggez::audio;
use ggez::conf;
use ggez::event::*;
You can’t perform that action at this time.