Struct icu_locid::extensions::unicode::Attribute [−][src]
pub struct Attribute(_);
An attribute used in a set of Attributes
.
An attribute has to be a sequence of alphanumerical characters no shorter than three and no longer than eight characters.
Examples
use icu::locid::extensions::unicode::Attribute; let attr: Attribute = "buddhist".parse() .expect("Failed to parse an Attribute."); assert_eq!(attr, "buddhist");
Implementations
impl Attribute
[src]
impl Attribute
[src]pub fn from_bytes(v: &[u8]) -> Result<Self, ParserError>
[src]
A constructor which takes a utf8 slice, parses it and
produces a well-formed Attribute
.
Examples
use icu::locid::extensions::unicode::Attribute; let attribute = Attribute::from_bytes(b"foobar") .expect("Parsing failed."); assert_eq!(attribute, "foobar");
Notice: No attribute subtags are defined by the current CLDR specification.
pub fn as_str(&self) -> &str
[src]
A helper function for displaying
a Attribute
subtag as a &
str
.
Examples
use icu::locid::extensions::unicode::Attribute; let attribute = Attribute::from_bytes(b"foobar") .expect("Parsing failed."); assert_eq!(attribute.as_str(), "foobar");
Notice
: For many use cases, such as comparison,
Attribute
implements PartialEq
<&
str
>
which allows for direct comparisons.
Trait Implementations
impl PartialOrd<Attribute> for Attribute
[src]
impl PartialOrd<Attribute> for Attribute
[src]impl StructuralEq for Attribute
[src]
impl StructuralEq for Attribute
[src]impl StructuralPartialEq for Attribute
[src]
impl StructuralPartialEq for Attribute
[src]Auto Trait Implementations
impl RefUnwindSafe for Attribute
impl RefUnwindSafe for Attribute
impl UnwindSafe for Attribute
impl UnwindSafe for Attribute