[][src]Struct langtag::Variant

pub struct Variant<T: ?Sized = [u8]> { /* fields omitted */ }

Single variant subtag.

Variant subtags are used to indicate additional, well-recognized variations that define a language or its dialects that are not covered by other available subtags.

Implementations

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

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

Parse and use the given data.

pub unsafe fn new_unchecked(t: T) -> Variant<T>[src]

Use the given data as buffer without parsing it.

Safety

The given data must be syntactically correct.

impl Variant<[u8]>[src]

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

Parse and borrow the given data.

pub unsafe fn parse_unchecked<'a, T: AsRef<[u8]> + ?Sized>(
    bytes: &'a T
) -> &'a Variant<[u8]>
[src]

Borrow the given data without checking that it is syntactically correct.

Safety

The data must be syntactically correct.

impl Variant<Vec<u8>>[src]

pub fn parse_copy<'a, T: AsRef<[u8]> + ?Sized>(
    bytes: &'a T
) -> Result<Variant<Vec<u8>>, Error>
[src]

Parse and copy the input data.

pub unsafe fn parse_copy_unchecked<'a, T: AsRef<[u8]> + ?Sized>(
    bytes: &'a T
) -> Variant<Vec<u8>>
[src]

Copy the input data without checking its syntax correctness.

Safety

The input data must be syntactically correct.

impl<T: AsRef<[u8]> + ?Sized> Variant<T>[src]

pub fn len(&self) -> usize[src]

Bytes length.

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

Return a reference to the underlying data.

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

Return a reference to the underlying data as a string.

Trait Implementations

impl<T: AsRef<[u8]> + ?Sized> AsRef<[u8]> for Variant<T>[src]

impl<T: AsRef<[u8]> + ?Sized> AsRef<str> for Variant<T>[src]

impl<T: AsRef<[u8]> + ?Sized> Debug for Variant<T>[src]

impl<T: ?Sized> Deref for Variant<T>[src]

type Target = T

The resulting type after dereferencing.

impl<T: AsRef<[u8]> + ?Sized> Display for Variant<T>[src]

impl<T: AsRef<[u8]> + ?Sized> Eq for Variant<T>[src]

impl<T: AsRef<[u8]> + ?Sized> Hash for Variant<T>[src]

impl<T: AsRef<[u8]> + ?Sized> Ord for Variant<T>[src]

impl<T: AsRef<[u8]> + ?Sized> PartialEq<[u8]> for Variant<T>[src]

impl<T: AsRef<[u8]> + ?Sized> PartialEq<Variant<T>> for [u8][src]

impl<T: AsRef<[u8]> + ?Sized> PartialEq<Variant<T>> for str[src]

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

impl<T: AsRef<[u8]> + ?Sized> PartialEq<str> for Variant<T>[src]

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

impl<'a> TryFrom<&'a [u8]> for &'a Variant<[u8]>[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a str> for &'a Variant<[u8]>[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

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

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

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

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

impl<T: ?Sized> UnwindSafe for Variant<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> 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.