pub struct LanguageTag(/* private fields */);Expand description
A well-formed BCP 47 language tag, as listed by sh:languageIn.
The check is syntactic (RFC 5646 well-formedness, including unique variants
and extension singletons); the IANA registry is not consulted. Spelling is
preserved, while equality, hashing and ordering are ASCII case-insensitive.
Serde decoding applies the same check as LanguageTag::try_new.
Implementations§
Source§impl LanguageTag
impl LanguageTag
Sourcepub fn try_new(lexical: impl Into<String>) -> Result<Self, StructuralModelError>
pub fn try_new(lexical: impl Into<String>) -> Result<Self, StructuralModelError>
Validate a language tag.
§Errors
Returns StructuralModelError::InvalidSyntax with
LexicalRole::LanguageTag for a malformed tag.
Trait Implementations§
Source§impl Clone for LanguageTag
impl Clone for LanguageTag
Source§impl Debug for LanguageTag
impl Debug for LanguageTag
Source§impl<'de> Deserialize<'de> for LanguageTag
impl<'de> Deserialize<'de> for LanguageTag
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for LanguageTag
impl Display for LanguageTag
impl Eq for LanguageTag
Source§impl Hash for LanguageTag
impl Hash for LanguageTag
Source§impl Ord for LanguageTag
impl Ord for LanguageTag
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for LanguageTag
impl PartialEq for LanguageTag
Auto Trait Implementations§
impl Forget for LanguageTag
impl Freeze for LanguageTag
impl Move for LanguageTag
impl RefUnwindSafe for LanguageTag
impl Send for LanguageTag
impl Sync for LanguageTag
impl Unpin for LanguageTag
impl UnsafeUnpin for LanguageTag
impl UnwindSafe for LanguageTag
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
Mutably borrows from an owned value. Read more