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
mod config { | |
pub enum Node<T> { | |
Directory(~str, ~[Node<T>]), | |
Entry(~str, T) | |
} | |
impl<T> Node<T> { | |
pub fn add(&mut self, entry: Node<T>) -> Option<&mut self> { | |
let succeeded = match *self { | |
Directory(_, ref mut list) => { list.push(entry); true } |
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
mod config { | |
pub enum Node<T> { | |
Directory(~str, ~[Node<T>]), | |
Entry(~str, T) | |
} | |
impl<T> Node<T> { | |
pub fn add(&mut self, entry: Node<T>) -> bool { | |
match *self { | |
Directory(_, ref mut list) => { list.push(entry); true } |
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
type ParseResult<S, R> = Result<(R, ~[S]), ~str>; | |
enum Parser<'a, S, R> { | |
Parser('a |&[S]| -> ~[ParseResult<S, R>]) | |
} | |
fn main() { | |
let p = Parser(/* missing argument here */); | |
println!("test"); | |
} |
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 pop<T, ..Stack>((_, ..stack): (T, ..Stack)) -> Stack { | |
stack | |
} | |
fn dup<T: Clone, ..Stack>((x, ..stack): (T, ..Stack)) -> (T, T, ..Stack) { | |
(x.clone(), x, ..stack) | |
} | |
fn swap<T, U, ..Stack>((x, y, ..stack): (T, U, ..Stack)) -> (U, T, ..Stack) { | |
(y, x, ..stack) |
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
#!/usr/bin/env bash | |
SED_SCRIPT=`echo '{\ | |
s/_\\$/$/g;\ | |
s/\\$BP\\$/\&/g;\ | |
s/\\$SP\\$/\@/g;\ | |
s/\\$LT\\$/</g;\ | |
s/\\$GT\\$/>/g;\ | |
s/\\$LP\\$/(/g;\ | |
s/\\$RP\\$/)/g;\ | |
s/\\$RF\\$/\\&/g;\ |
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
/* | |
Tests the Any trait. | |
*/ | |
pub struct Player { | |
name: ~str | |
} |
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 unsafe fn allocMegaGroup(mblocks: nat) -> ~Block { | |
let n = MBLOCK_GROUP_BLOCKS(mblocks); | |
enum SearchResult<'a> { | |
PerfectMatch(~Block), | |
BestMatch(&'a mut BlockData, &'a mut BlockMeta), | |
NoMatch | |
} | |
fn go<'a>(n: uint, | |
prev_link: &'a mut Option<~Block>, | |
best: Option<(&'a mut BlockData, &'a mut BlockMeta)>) |
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
// array per definizione nomi da 0 a 19 | |
static a19: [&'static str, ..20] = [ | |
"", "uno", "due", "tre", | |
"quattro","cinque", "sei", "sette", "otto", | |
"nove", "dieci", "undici", "dodici", | |
"tredici", "quattordici", "quindici", | |
"sedici", "diciassette", "diciotto", | |
"diciannove" | |
]; |
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
( | |
|a: |b: |||| a(|| {}) | |
)( | |
|b: ||| b() | |
) |
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 (ref cfg, ref appCfg) = { | |
let prefix = Path::new(getenv("HOME").unwrap_or(~"")); | |
(prefix.join(".Sync.conf"), prefix.join(".Mirana.conf")) | |
}; |