[−][src]Struct langtag::LangTag
Normal language subtag.
The language subtag can be modified when the internal buffer type (T
) is Vec<u8>
.
Implementations
impl<'a> LangTag<&'a [u8]>
[src]
pub fn parse<T: AsRef<[u8]> + ?Sized>(
bytes: &'a T
) -> Result<LangTag<&'a [u8]>, Error>
[src]
bytes: &'a T
) -> Result<LangTag<&'a [u8]>, Error>
Parse a normal language tag.
impl LangTag<Vec<u8>>
[src]
pub fn parse_copy<T: AsRef<[u8]> + ?Sized>(
bytes: &T
) -> Result<LangTag<Vec<u8>>, Error>
[src]
bytes: &T
) -> Result<LangTag<Vec<u8>>, Error>
Parse and copy a normal language tag.
The returned normal language tag owns its buffer.
impl<T: AsRef<[u8]>> LangTag<T>
[src]
pub fn new(data: T) -> Result<LangTag<T>, Error>
[src]
Create a new normal language tag by parsing and using the given buffer.
pub fn into_raw_parts(self) -> (T, ParsedLangTag)
[src]
Consume the tag and returns its internal buffer along with the parsing metadata.
pub unsafe fn from_raw_parts(data: T, p: ParsedLangTag) -> LangTag<T>
[src]
Create a new normal language tag using p
as parsing metadata.
Safety
The input data is not checked for well-formedness, which must be ensred by the caller.
pub fn inner(&self) -> &T
[src]
Returns a reference to the tag's buffer.
pub fn parsing_data(&self) -> ParsedLangTag
[src]
Returns a copy of the parsing metadata.
pub fn as_bytes(&self) -> &[u8]
[src]
Returns the bytes representation of the tag.
pub fn as_str(&self) -> &str
[src]
Returns the string representation of the tag.
pub fn language(&self) -> &Language
[src]
Get the 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<T: AsMut<Vec<u8>>> LangTag<T>
[src]
pub fn language_mut(&mut self) -> LanguageMut<'_>
[src]
Get and modify the language subtags.
pub fn set_language(&mut self, lang: &Language)
[src]
Set the language subtags.
pub fn set_script(&mut self, script: Option<&Script>)
[src]
Set the script subtag.
pub fn set_region(&mut self, region: Option<&Region>)
[src]
Set the region subtag.
pub fn variants_mut(&mut self) -> VariantsMut<'_>
[src]
Get and modify the variant subtags.
pub fn extensions_mut(&mut self) -> ExtensionsMut<'_>
[src]
Get and modify the extension subtags.
pub fn private_use_subtags_mut(&mut self) -> PrivateUseSubtagsMut<'_>
[src]
Get and modify the private use subtags.
Trait Implementations
impl<T: Clone> Clone for LangTag<T>
[src]
impl<T: AsRef<[u8]>> Debug for LangTag<T>
[src]
impl<T: AsRef<[u8]>> Display for LangTag<T>
[src]
impl<T: AsRef<[u8]>> Eq for LangTag<T>
[src]
impl<T: AsRef<[u8]>> Hash for LangTag<T>
[src]
pub fn hash<H: Hasher>(&self, h: &mut H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T: AsRef<[u8]>, U: AsRef<[u8]>> PartialEq<LangTag<U>> for LangTag<T>
[src]
pub fn eq(&self, other: &LangTag<U>) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<T: AsRef<[u8]>, U: AsRef<[u8]> + ?Sized> PartialEq<U> for LangTag<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for LangTag<T> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T> Send for LangTag<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for LangTag<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for LangTag<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for LangTag<T> where
T: UnwindSafe,
[src]
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,