[][src]Enum langtag::LanguageTagBuf

pub enum LanguageTagBuf<T = Vec<u8>> {
    Normal(LangTag<T>),
    PrivateUse(PrivateUseTag<T>),
    Grandfathered(GrandfatheredTag),
}

Language tag with owned data.

Variants

Normal(LangTag<T>)

Normal language tag.

PrivateUse(PrivateUseTag<T>)

Private use tag.

Grandfathered(GrandfatheredTag)

Grandfathered tag.

Implementations

impl<T: AsRef<[u8]>> LanguageTagBuf<T>[src]

pub fn new(t: T) -> Result<LanguageTagBuf<T>, Error>[src]

Create a new language tag parsing and using the given data.

pub fn as_ref(&self) -> LanguageTag<'_, T>[src]

Returns a LanguageTag referencing this tag.

impl LanguageTagBuf[src]

pub fn parse_copy<T: AsRef<[u8]> + ?Sized>(
    t: &T
) -> Result<LanguageTagBuf, Error>
[src]

reate a new language tag owning its data by parsing and copying the given data.

impl<T: AsRef<[u8]>> LanguageTagBuf<T>[src]

pub fn as_bytes(&self) -> &[u8][src]

Returns the bytes representation of the language tag.

pub fn as_str(&self) -> &str[src]

Returns the string representation of the language tag.

pub fn is_normal(&self) -> bool[src]

Checks if this is a normal language tag.

pub fn is_private_use(&self) -> bool[src]

Checks if this is a private use tag.

pub fn is_grandfathered(&self) -> bool[src]

Checks if this is a grandfathered tag.

pub fn language(&self) -> Option<&Language>[src]

Get the language subtags, if any.

Only normal language tags and regular grandfathered tags have language subtags.

pub fn script(&self) -> Option<&Script>[src]

Get the script subtag, if any.

pub fn region(&self) -> Option<&Region>[src]

Get the region subtag, if any.

pub fn variants(&self) -> &Variants[src]

Get the variant subtags.

pub fn extensions(&self) -> &Extensions[src]

Get the extension subtags.

pub fn private_use_subtags(&self) -> &PrivateUseSubtags[src]

Get the private use subtags.

Trait Implementations

impl<T: AsRef<[u8]>> AsRef<[u8]> for LanguageTagBuf<T>[src]

impl<T: AsRef<[u8]>> AsRef<str> for LanguageTagBuf<T>[src]

impl<T: Clone> Clone for LanguageTagBuf<T>[src]

impl<T: AsRef<[u8]>> Debug for LanguageTagBuf<T>[src]

impl<T: AsRef<[u8]>> Display for LanguageTagBuf<T>[src]

impl<T: AsRef<[u8]>> Eq for LanguageTagBuf<T>[src]

impl<T: AsRef<[u8]>> Hash for LanguageTagBuf<T>[src]

impl<T: AsRef<[u8]>> Ord for LanguageTagBuf<T>[src]

impl<T: AsRef<[u8]>, U: AsRef<[u8]> + ?Sized> PartialEq<U> for LanguageTagBuf<T>[src]

impl<T: AsRef<[u8]>, U: AsRef<[u8]>> PartialOrd<U> for LanguageTagBuf<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for LanguageTagBuf<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for LanguageTagBuf<T> where
    T: Send
[src]

impl<T> Sync for LanguageTagBuf<T> where
    T: Sync
[src]

impl<T> Unpin for LanguageTagBuf<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for LanguageTagBuf<T> where
    T: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.