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 Locale { | |
fn to_upper(s: &str) {} | |
} | |
struct Indifferent; | |
impl Locale for Indifferent {} | |
static mut current_locale : &'static Locale = &'static Indifferent as &'static Locale; |
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 Locale { | |
fn to_upper(s: &str) {} | |
} | |
struct Indifferent; | |
impl Locale for Indifferent {} | |
#[test] | |
fn test_indifferent(){ | |
let l: &Locale = &Indifferent; |
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(macro_rules)]; | |
struct Grapheme<'r> { | |
codepoint: &'r [CodePoint] | |
} | |
struct Graphemes<'r> { | |
chars: std::str::Chars<'r> | |
} |
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 unicode { | |
struct Cluster<'a> { | |
chars: &'a [char] | |
} | |
pub fn unpack<'a>(s: &str) -> &'a [Cluster<'a>] { | |
let mut clusters = ~[]; | |
// let cluster = Cluster { chars: &'static [] }; | |
// clusters.push(cluster); | |
clusters.as_slice() |
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 UpperChars<'a> { | |
chars: std::str::Chars<'a> | |
} | |
struct LowerChars<'a> { | |
chars: std::str::Chars<'a> | |
} | |
fn lower_chars<'a>(s: &'a str) -> LowerChars<'a> { | |
LowerChars { chars: s.chars() } |
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 LowerChars<'a> { | |
chars: std::str::Chars<'a> | |
} | |
fn lower<'a>(s: &'a str) -> LowerChars<'a> { | |
LowerChars { chars: s.chars() } | |
} | |
impl<'a> Iterator<char> for LowerChars<'a> { | |
fn next(&mut self) -> Option<char> { |
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
/* soon to be auto-generated */ | |
use std::cmp::{Equal, Less, Greater}; | |
use std::vec::ImmutableVector; | |
use std::option::None; | |
static LETTER_UPPERCASE : &'static [(char, char)] = &[ | |
('\x41', '\x5a') | |
]; |
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
#[allow(ctypes, dead_code)]; | |
#[feature(globs)]; | |
use std::str; | |
use std::libc::{ c_char }; | |
pub type UChar = u16; | |
pub type UChar32 = i32; |
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
fn pos(pos: int, len: uint) -> uint { | |
let ilen = len as int; | |
let result = match pos { | |
p if p < 0 && ilen + p < 0 => 0, | |
p if p < 0 => ilen + p, | |
p => p | |
} as uint; | |
result | |
} |
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
#[allow(ctypes, dead_code)]; | |
#[feature(globs)]; | |
use std::vec; | |
pub type UBool = u8; | |
pub type UProperty = int; | |
pub type UChar = u16; | |
pub type UChar32 = i32; |