Expand description
Idiomatic types for locale identifiers.
This crate provides a Locale
enumeration,
LocaleIdentifier
trait, and a
LocaleString
structure are provided that
may be used to parse and construct locale identifiers in a
standards-conformant manner.
§Example
use locale_types::{LocaleIdentifier, LocaleString};
let locale = LocaleString::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 id::LocaleIdentifier;
pub use string::LocaleString;
pub use locale::Locale;
Modules§
- id
- Provides a single trait that describes common structure for local identifiers.
- locale
- Provides a layer above the
LocaleString
for different locale specifiers. - string
- The
LocaleString
type provides the a structure for locale identifier strings.
Enums§
- Locale
Error - Common error type for functions in this crate.
Type Aliases§
- Locale
Result - Common result type for functions in this crate.