pub struct LangTag(/* private fields */);Expand description
Any language tag (normal, private use or grandfathered).
Implementations§
Source§impl LangTag
impl LangTag
pub const fn validate_str(input: &str) -> bool
pub const fn validate_bytes(input: &[u8]) -> bool
Source§impl LangTag
impl LangTag
Sourcepub fn new<T>(input: &T) -> Result<&LangTag, InvalidLangTag<&T>>
pub fn new<T>(input: &T) -> Result<&LangTag, InvalidLangTag<&T>>
Creates a new langtag by parsing the input value.
Sourcepub const fn from_bytes(input: &[u8]) -> Result<&LangTag, InvalidLangTag<&[u8]>>
pub const fn from_bytes(input: &[u8]) -> Result<&LangTag, InvalidLangTag<&[u8]>>
Creates a new langtag by parsing the input bytes.
Sourcepub const fn from_str(input: &str) -> Result<&LangTag, InvalidLangTag<&str>>
pub const fn from_str(input: &str) -> Result<&LangTag, InvalidLangTag<&str>>
Creates a new langtag by parsing the input string.
Sourcepub const unsafe fn new_unchecked_from_bytes(input: &[u8]) -> &LangTag
pub const unsafe fn new_unchecked_from_bytes(input: &[u8]) -> &LangTag
Creates a new langtag from the input bytes without validation.
§Safety
The input bytes must be a valid langtag.
Sourcepub const unsafe fn new_unchecked(input: &str) -> &LangTag
pub const unsafe fn new_unchecked(input: &str) -> &LangTag
Creates a new langtag from the input string without validation.
§Safety
The input string must be a valid langtag.
Source§impl LangTag
impl LangTag
Sourcepub fn language(&self) -> Option<&Language>
pub fn language(&self) -> Option<&Language>
Returns the language subtags, if any.
Only normal language tags and regular grandfathered tags have language subtags.
Sourcepub fn extensions(&self) -> &Extensions
pub fn extensions(&self) -> &Extensions
Returns the extension subtags, if any.
Sourcepub fn private_use(&self) -> Option<&PrivateUse>
pub fn private_use(&self) -> Option<&PrivateUse>
Returns the private use subtag, if any.
Returns an iterator over the private use subtag subtags.
Sourcepub fn is_normal(&self) -> bool
pub fn is_normal(&self) -> bool
Returns wether or not this language tag is a normal language tag.
Sourcepub fn is_private_use(&self) -> bool
pub fn is_private_use(&self) -> bool
Returns wether or not this language tag is a private use tag.
Sourcepub fn is_grandfathered(&self) -> bool
pub fn is_grandfathered(&self) -> bool
Returns wether or not this language tag is a grandfathered tag.
Sourcepub fn as_normal(&self) -> Option<&NormalLangTag>
pub fn as_normal(&self) -> Option<&NormalLangTag>
Returns this language tag as a normal tag, if it is one.
Sourcepub fn as_private_use(&self) -> Option<&PrivateUse>
pub fn as_private_use(&self) -> Option<&PrivateUse>
Returns this language tag as a private use tag, if it is one.
Sourcepub fn as_grandfathered(&self) -> Option<GrandfatheredLangTag>
pub fn as_grandfathered(&self) -> Option<GrandfatheredLangTag>
Returns this language tag as a grandfathered tag, if it is one.
Sourcepub fn as_typed(&self) -> TypedLangTag<'_>
pub fn as_typed(&self) -> TypedLangTag<'_>
Find out what kind of language tag self is.
Trait Implementations§
Source§impl AsRef<LangTag> for LangTagBuf
impl AsRef<LangTag> for LangTagBuf
Source§impl Borrow<LangTag> for LangTagBuf
impl Borrow<LangTag> for LangTagBuf
impl Eq for LangTag
Source§impl PartialEq<&LangTag> for LangTagBuf
impl PartialEq<&LangTag> for LangTagBuf
Source§impl PartialEq<LangTag> for LangTagBuf
impl PartialEq<LangTag> for LangTagBuf
Source§impl PartialEq<LangTagBuf> for LangTag
impl PartialEq<LangTagBuf> for LangTag
Source§impl PartialEq<LangTagBuf> for &LangTag
impl PartialEq<LangTagBuf> for &LangTag
Source§impl PartialOrd for LangTag
impl PartialOrd for LangTag
Source§impl PartialOrd<&LangTag> for LangTagBuf
impl PartialOrd<&LangTag> for LangTagBuf
Source§impl PartialOrd<&[u8]> for LangTag
impl PartialOrd<&[u8]> for LangTag
Source§impl PartialOrd<&str> for LangTag
impl PartialOrd<&str> for LangTag
Source§impl PartialOrd<LangTag> for LangTagBuf
impl PartialOrd<LangTag> for LangTagBuf
Source§impl PartialOrd<LangTagBuf> for LangTag
impl PartialOrd<LangTagBuf> for LangTag
Source§impl PartialOrd<LangTagBuf> for &LangTag
impl PartialOrd<LangTagBuf> for &LangTag
Source§impl PartialOrd<String> for LangTag
impl PartialOrd<String> for LangTag
Source§impl PartialOrd<Vec<u8>> for LangTag
impl PartialOrd<Vec<u8>> for LangTag
Source§impl PartialOrd<[u8]> for LangTag
impl PartialOrd<[u8]> for LangTag
Source§impl PartialOrd<str> for LangTag
impl PartialOrd<str> for LangTag
Source§impl RdfDisplay for LangTag
impl RdfDisplay for LangTag
Source§impl ToOwned for LangTag
impl ToOwned for LangTag
Source§type Owned = LangTagBuf
type Owned = LangTagBuf
Source§fn to_owned(&self) -> <LangTag as ToOwned>::Owned
fn to_owned(&self) -> <LangTag as ToOwned>::Owned
1.63.0 · Source§fn clone_into(&self, target: &mut Self::Owned)
fn clone_into(&self, target: &mut Self::Owned)
Auto Trait Implementations§
impl !Sized for LangTag
impl Freeze for LangTag
impl RefUnwindSafe for LangTag
impl Send for LangTag
impl Sync for LangTag
impl Unpin for LangTag
impl UnsafeUnpin for LangTag
impl UnwindSafe for LangTag
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
self is equivalent to key.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.