Struct icu_locid::extensions::transform::Transform [−][src]
pub struct Transform { pub lang: Option<LanguageIdentifier>, pub fields: Fields, }
A list of Unicode BCP47 T Extensions
as defined in Unicode Locale Identifier
specification.
Transform extension carries information about source language or script of
transformed content, including content that has been transliterated, transcribed,
or translated, or in some other way influenced by the source (See RFC 6497
for details).
Examples
use icu::locid::{Locale, LanguageIdentifier}; use icu::locid::extensions::transform::{Key, Value}; let mut loc: Locale = "de-t-en-US-h0-hybrid".parse() .expect("Parsing failed."); let en_us: LanguageIdentifier = "en-US".parse() .expect("Parsing failed."); assert_eq!(loc.extensions.transform.lang, Some(en_us)); let key: Key = "h0".parse().expect("Parsing key failed."); let value: Value = "hybrid".parse().expect("Parsing value failed."); assert_eq!( loc.extensions.transform.fields.get(&key), Some(&value) );
Fields
lang: Option<LanguageIdentifier>
fields: Fields
Implementations
impl Transform
[src]
impl Transform
[src]pub const fn new() -> Self
[src]
Returns a new empty map of Transform extensions. Same as default()
, but is const
.
Examples
use icu::locid::extensions::transform::Transform; assert_eq!(Transform::new(), Transform::default());
pub fn is_empty(&self) -> bool
[src]
Returns true
if there are no tfields and no tlang in the TransformExtensionList
.
Examples
use icu::locid::Locale; let mut loc: Locale = "en-US-t-es-AR".parse() .expect("Parsing failed."); assert_eq!(loc.extensions.transform.is_empty(), false);
Trait Implementations
impl PartialOrd<Transform> for Transform
[src]
impl PartialOrd<Transform> for Transform
[src]impl StructuralEq for Transform
[src]
impl StructuralEq for Transform
[src]impl StructuralPartialEq for Transform
[src]
impl StructuralPartialEq for Transform
[src]Auto Trait Implementations
impl RefUnwindSafe for Transform
impl RefUnwindSafe for Transform
impl UnwindSafe for Transform
impl UnwindSafe for Transform