[][src]Crate locale_strict

Idiomatic, strictly validated, types for locale identifiers.

This crate provides a strict version of the LocaleString structure provided by the locale-types crate. For each of the fields language code, territory, and code set the values passed to the constructors will be validated using the locale-codes crate to ensure they are valid identifiers according to the corresponding standards.

Example

use locale_types::LocaleIdentifier;
use locale_strict::StrictLocaleString;

let locale = StrictLocaleString::new("en".to_string()).unwrap()
    .with_territory("US".to_string()).unwrap()
    .with_code_set("UTF-8".to_string()).unwrap()
    .with_modifier("collation=pinyin;currency=CNY".to_string()).unwrap();
println!("{}", locale);

Re-exports

pub use string::StrictLocaleString;

Modules

string

The StrictLocaleString type provides a LocaleIdentifier that validates that language, territory, and code set identifiers are present in the corresponding standards.