Skip to content

Instantly share code, notes, and snippets.

#[test]
fn try_success() {
alt task::try {||
"Success!"
} {
result::ok("Success!") { }
_ { fail; }
}
}
gcc oldrust newrust oldrust% newrust%
ackermann 6.118s 9.350s 8.737s 153% 142%
binarytrees 3.112s 15.505s 22.585s 498% 726%
fannkuchredux 5.201s 9.523s 8.345s 183% 160%
fibo 3.314s 15.235s 11.129s 460% 336%
nbody 3.300s 4.734s 11.005s 144% 334%
tag modlist = [int];
fn main() {
let ml = modlist([]);
assert ml == modlist([]);
assert ml == modlist([]);
@brson
brson / gist:1625144
Created January 17, 2012 06:24 — forked from killerswan/gist:1625138
reserve_empty
fn reserve_empty(nn: uint) -> str unsafe {
// start with a null-terminated 0-length string
let ss = "";
// make a vector
let vv: [u8] = unsafe::reinterpret_cast(ss);
unsafe::leak(ss);
// expand it to size + \0
vec::reserve(vv, nn+1u);

Crate core

Module box

Function ptr_eq

Determine if two shared boxes point to the same object

Arguments:

Crate rustdoc

Rustdoc - The Rust documentation generator

Function run_passes

Run a series of passes over the document

Arguments:

Crate rustdoc

Rustdoc - The Rust documentation generator

Function run_passes

Run a series of passes over the document

Arguments:

Crate core

Module box

Function ptr_eq

Determine if two shared boxes point to the same object

Arguments:

Crate rustdoc

Rustdoc - The Rust documentation generator

Function run_passes

fn run_passes(srv: astsrv::srv, doc: doc::cratedoc, passes: [pass]) ->
   doc::cratedoc
Version 0.1 (January 2012)
---------------------------
* Most language features work, including:
* Pattern matching and destructuring assignment
* Multithread task scheduling