Expand description
env-lang
return env LANG’ struct with language, localisation, charset and variant
Example
extern crate env_lang;
use env_lang::{to_struct, EnvLang};
fn main() {
let lang_env = "fr_FR.UTF-8@euro"; // or std::env::var("LANG")
let result: EnvLang = to_struct(&lang_env).unwrap();
assert!(result == EnvLang{
language: Some("fr"),
localisation: Some("FR"),
charset: Some("UTF-8"),
variant: Some("euro")
});
}
Links
github: https://github.com/AlbanMinassian/env-lang
license
MIT
Structs
Enums
Functions
return struct EnvLang or an error EnvLangErrorKind