This file contains hidden or 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(unsize)] | |
#![feature(raw)] | |
#![feature(const_fn)] | |
use std::marker::{Unsize, PhantomData}; | |
use std::fmt::Display; | |
use std::fmt::Debug; | |
use std::raw::TraitObject; | |
use std::cell::Cell; | |
use std::mem; |
This file contains hidden or 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(unsize)] | |
#![feature(raw)] | |
#![feature(const_fn)] | |
use std::marker::{Unsize, PhantomData}; | |
use std::fmt::Display; | |
use std::raw::TraitObject; | |
use std::cell::Cell; | |
use std::mem; | |
use std::ops::Deref; |
This file contains hidden or 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::{io,mem,raw,cast}; | |
struct BlobContainingSlices<'a> { | |
data:~[u8], | |
subset1: &'a [u32], | |
subset2: &'a [u16], | |
} | |
fn slice_within_as<TO,FROM>(owner:&[FROM], start:uint, len_in_new_units:uint)->&[TO] { |
This file contains hidden or 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) | |
} | |
pub fn add_entry<'a, T>(node: &'a mut Node<T>, entry: Node<T>) -> Option<&'a mut Node<T>> { | |
if match node { | |
&Directory(_, ref mut list) => { list.push(entry); true } | |
_ => false |
This file contains hidden or 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) | |
} | |
pub fn add_entry<T>(node: &Node<T>, entry: &Node<T>) -> ::std::option::Option<&Node<T>> { | |
match node { | |
Directory(name, list) => { ::std::vec::append_one(list, entry); Some(node) } | |
_ => { None } |
This file contains hidden or 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
enum X { | |
A(~str), | |
B(~str) | |
} | |
struct Y { | |
x: X | |
} | |
fn f(a: &mut Y) { |
This file contains hidden or 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 NotFancy<T> { | |
x: Option<T> | |
} | |
impl<T> NotFancy<T> { | |
fn simple0<'a>(&'a self) -> Option<&'a T> { | |
match *self.x { | |
Some(ref t) => Some(t), | |
None => None | |
} |
This file contains hidden or 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
trait Category<S, T> { | |
fn id<A, AA: Category<A, A>>() -> AA; | |
fn compose<A, B, C, AB: Category<A, B>, BC: Category<B, C>, AC: Category<A, C>>(BC, AB) -> AC; | |
} | |
impl<'a, S, T> Category<S, T> for ('a |S| -> T) { | |
fn id<A, |A| -> A>() -> ('a |A| -> A) { | |
|a: A| -> A { a } | |
} |
This file contains hidden or 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 output_stream::OutputStream; | |
use message::Message; | |
use wire_type::LengthDelimited; | |
pub struct OutputCounter { | |
byte_count: uint, | |
nested: ~[uint] | |
} | |
impl OutputCounter { |
This file contains hidden or 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 (cfg, appCfg) = if nix {( | |
& Path::new ( "~/.Sync.conf" ) , | |
& Path::new ( "~/.Mirana.conf" ) | |
)} else { | |
let prefix = getenv("HOME").unwrap_or(~""); | |
( | |
& Path::new ( prefix + "~/.Sync.conf" ), | |
& Path::new ( prefix + "~/.Mirana.conf" ) | |
) | |
}; |