[][src]Enum langtag::LanguageTag

pub enum LanguageTag<'a, T: ?Sized = [u8]> {
    Normal(LangTag<&'a T>),
    PrivateUse(&'a PrivateUseTag<T>),
    Grandfathered(GrandfatheredTag),
}

Language tag with borrowed data.

Variants

Normal(LangTag<&'a T>)

Normal language tag.

PrivateUse(&'a PrivateUseTag<T>)

Private use tag.

Grandfathered(GrandfatheredTag)

Grandfathered tag.

Implementations

impl<'a, T: AsRef<[u8]> + ?Sized> LanguageTag<'a, 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.

impl<'a> LanguageTag<'a>[src]

pub fn parse<T: AsRef<[u8]> + ?Sized>(
    t: &'a T
) -> Result<LanguageTag<'a>, Error>
[src]

Create a new language tag by parsing and borrowing the given data.

Trait Implementations

impl<'a, T: AsRef<[u8]> + ?Sized> AsRef<[u8]> for LanguageTag<'a, T>[src]

impl<'a, T: AsRef<[u8]> + ?Sized> AsRef<str> for LanguageTag<'a, T>[src]

impl<'a, T: AsRef<[u8]> + ?Sized> Debug for LanguageTag<'a, T>[src]

impl<'a, T: AsRef<[u8]> + ?Sized> Display for LanguageTag<'a, T>[src]

impl<'a, T: AsRef<[u8]> + ?Sized> Eq for LanguageTag<'a, T>[src]

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

Auto Trait Implementations

impl<'a, T: ?Sized> RefUnwindSafe for LanguageTag<'a, T> where
    T: RefUnwindSafe
[src]

impl<'a, T: ?Sized> Send for LanguageTag<'a, T> where
    T: Sync
[src]

impl<'a, T: ?Sized> Sync for LanguageTag<'a, T> where
    T: Sync
[src]

impl<'a, T: ?Sized> Unpin for LanguageTag<'a, T>[src]

impl<'a, T: ?Sized> UnwindSafe for LanguageTag<'a, T> where
    T: RefUnwindSafe
[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> 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.