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
let mut result = "".into_string(); | |
let mut chars = remainder.chars(); | |
while let Some(c) = chars.next() { | |
if c == '-' { | |
match chars.next() { | |
Some(c @ 'a'...'z') => { | |
result.push(c.to_uppercase()); | |
} | |
Some(c) => { | |
result.push('-'); |
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
#![feature(macro_rules)] | |
extern crate curl; | |
extern crate libc; | |
extern crate serialize; | |
use std::io::process::{Command, InheritFd}; | |
use std::io::{stdio, File, BufReader}; | |
use std::os; |
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
pub trait Show { | |
#[derive_scheme( | |
TupleLike { try!(fmt.write_str(concat!($_name, "("))); try!($_); fmt.write(b")") } | |
StructLike { try!(fmt.write_str(concat!($_name, "{"))); try!($_); fmt.write(b"}") } | |
UnitLike { fmt.write_str($_name) } | |
AnonymousList { try!($_);try!(fmt.write_str(",")) } | |
NamedList { try!(fmt.write_str(concat!($_name, ":")));try!($_);try!(fmt.write_str(",")) } | |
)] | |
fn fmt(&self, fmt: &mut Formatter) -> Result; | |
} |
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
// <core> | |
#[lang="vtable"] | |
struct Vtable<T, Sized? Trait>(&'static (unsafe fn(*mut T), uint, uint)); | |
extern "rust-intrinsic" { fn get_vtable<T, Sized? Trait>() -> Vtable<T, Trait>; } | |
#[lang="has_vtable"] | |
trait HasVtable<T, Sized? Trait> {} | |
// </core> | |
#[repr(fixed, inline_vtable)] | |
trait Node: Any { |
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
use std::num::zero; | |
use std::rand::Rng; | |
use std::rand::distributions::range::SampleRange; | |
use vecmath::vector::Vec3; | |
use vecmath::ray::Ray; | |
use lightray::Lightray; | |
use objecthit::ObjectHit; |
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 linked_face(vertexes: &[Rc<RefCell<Vertex>>], face: UnlinkedFace) -> Option<RefCell<Face>> { | |
Some(RefCell::new(Face { | |
a: match vertexes.get(face.a) { | |
Some(x) => x.clone(), | |
None => return None | |
}, | |
b: match vertexes.get(face.b) { | |
Some(x) => x.clone(), | |
None => return None | |
}, |
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
#![crate_id = ""] | |
#![deny(missing_doc)] | |
#![feature(macro_rules)] | |
//! Documentation goes here. | |
extern crate openssl; | |
extern crate serialize; | |
use std::io; |
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
static NTASKS: uint = 10; | |
fn main() { | |
let mut array = [0u, ..NTASKS]; | |
for (x, i) in array.mut_iter().enumerate() { | |
let ptr = x as *mut _; | |
spawn(proc() { | |
let inner_x = unsafe {&mut *ptr}; |
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
0: Split(1, 5) | |
1: OneChar(a, 0) | |
2: CharClass([(b, c)], 0) | |
3: OneChar(d, 0) | |
4: Match | |
5: OneChar(r, 0) | |
6: Split(5, 7) | |
7: Match |
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
struct Blob<HEADER> { | |
data:~[u8], | |
} | |
impl<T> std::ops::Deref<T> for Blob<T> { | |
fn deref<'s>(&'s self)->&'s T { | |
//assert!(self.num_bytes() > std::intrinsics::size_of::<T>()); | |
unsafe { &*(&self.data[0] as *u8 as *T) | |
} |