Struct icu_locid::extensions::private::Key [−][src]
pub struct Key(_);
A single item used in a list of Private
extensions.
The key has to be an ASCII alphanumerical string no shorter than one character and no longer than eight.
Examples
use icu::locid::extensions::private::Key; let key1: Key = "Foo".parse() .expect("Failed to parse a Key."); assert_eq!(key1.as_str(), "foo");
Implementations
impl Key
[src]
impl Key
[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 Key
.
Examples
use icu::locid::extensions::private::Key; let key = Key::from_bytes(b"foobar") .expect("Parsing failed."); assert_eq!(key.as_str(), "foobar");
pub fn as_str(&self) -> &str
[src]
A helper function for displaying
a Key
as a &
str
.
Examples
use icu::locid::extensions::private::Key; let key = Key::from_bytes(b"foobar") .expect("Parsing failed."); assert_eq!(key.as_str(), "foobar");
Notice
: For many use cases, such as comparison,
Key
implements PartialEq
<&
str
>
which allows for direct comparisons.
Trait Implementations
impl PartialOrd<Key> for Key
[src]
impl PartialOrd<Key> for Key
[src]impl StructuralEq for Key
[src]
impl StructuralEq for Key
[src]impl StructuralPartialEq for Key
[src]
impl StructuralPartialEq for Key
[src]Auto Trait Implementations
impl RefUnwindSafe for Key
impl RefUnwindSafe for Key
impl UnwindSafe for Key
impl UnwindSafe for Key