This file contains 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
// Rust IO Test | |
// Based on samples presented in Rob Pike's Go Concurrency talk | |
use std::libc::funcs::posix88::unistd::sleep; | |
use std::rand::random; | |
use std::comm::{Chan, Port}; | |
struct Message { | |
string: ~str, | |
wait_chan: Chan<bool>, |
This file contains 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
fn main() { | |
// Match parsed group lengths with expected - test data | |
let group_lengths: ~[(&int, &int)] = ~[(&8, &8), (&4, &4), (&4, &4), (&4, &4), (&8, &12)]; | |
// ~~~ | |
// ~~~ Problem 1: all vs take_while and unpacking tuple | |
// ~~~ | |
// This works |
This file contains 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
// iterator.rs | |
pub trait IteratorUtil<A> { | |
// ... | |
fn repeat_(&mut self) -> RepeatIterator<A, Self>; | |
} | |
//... | |
#[inline] | |
fn repeat_(&mut self) -> RepeatIterator<A, T> { | |
RepeatIterator{iter: self, iter_orig: copy self} |
This file contains 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
// Cribbed from Rust libstd test code | |
// Causes a linker error on OS X | |
use std::cell::Cell; | |
use std::task::Task; | |
use std::rt::io::net::tcp; | |
use std::rt::io::net::ip; | |
use std::rt::local::Local; | |
use std::rt::io::{Reader, Writer, Listener}; |
This file contains 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
/* | |
OpenCL Utility functions | |
*/ | |
#ifndef CLUTILS_H_INC | |
#define CLUTILS_H_INC | |
#include <OpenCL/cl.h> | |
const char* clErrorString(cl_int err); |
NewerOlder