Created
March 4, 2014 18:03
-
-
Save pzol/9352100 to your computer and use it in GitHub Desktop.
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::local_data; | |
trait Locale { | |
fn to_upper(&self, s: &str) {} | |
} | |
struct Indifferent; | |
impl Locale for Indifferent {} | |
local_data_key!(key_current_locale: &'static Locale) | |
static indifferent: Indifferent = Indifferent; | |
fn current() -> &Locale { | |
local_data::get(key_current_locale, |_opt| &indifferent as &Locale) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment