pub struct LenientLangTag(/* private fields */);Expand description
Language tag that may not be well-formed.
JSON-LD accepts any string as a @language value, so an ill-formed tag must
be preserved rather than rejected. Comparison, ordering and hashing are
ASCII-case-insensitive, as language tags are case-insensitive.
Implementations§
Source§impl LenientLangTag
impl LenientLangTag
Sourcepub fn new(s: &str) -> (&Self, Option<InvalidLangTag<&str>>)
pub fn new(s: &str) -> (&Self, Option<InvalidLangTag<&str>>)
Borrows the given string as a language tag, along with the error produced by validating it, if it is not well-formed.
Sourcepub fn is_well_formed(&self) -> bool
pub fn is_well_formed(&self) -> bool
Checks whether this tag is a well-formed language tag.
Sourcepub fn as_well_formed(&self) -> Option<&LangTag>
pub fn as_well_formed(&self) -> Option<&LangTag>
Borrows this tag as a well-formed LangTag, or returns None if it
is not well-formed.
Trait Implementations§
Source§impl AsRef<LenientLangTag> for LenientLangTagBuf
impl AsRef<LenientLangTag> for LenientLangTagBuf
Source§fn as_ref(&self) -> &LenientLangTag
fn as_ref(&self) -> &LenientLangTag
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl AsRef<str> for LenientLangTag
impl AsRef<str> for LenientLangTag
Source§impl Borrow<LenientLangTag> for LenientLangTagBuf
impl Borrow<LenientLangTag> for LenientLangTagBuf
Source§fn borrow(&self) -> &LenientLangTag
fn borrow(&self) -> &LenientLangTag
Immutably borrows from an owned value. Read more
Source§impl Debug for LenientLangTag
impl Debug for LenientLangTag
Source§impl Display for LenientLangTag
impl Display for LenientLangTag
impl Eq for LenientLangTag
Source§impl Hash for LenientLangTag
impl Hash for LenientLangTag
Source§impl Ord for LenientLangTag
impl Ord for LenientLangTag
Source§impl PartialEq for LenientLangTag
impl PartialEq for LenientLangTag
Source§impl PartialOrd for LenientLangTag
impl PartialOrd for LenientLangTag
Source§impl PrecomputeSize for LenientLangTag
impl PrecomputeSize for LenientLangTag
Source§impl Print for LenientLangTag
impl Print for LenientLangTag
Source§fn fmt_with(
&self,
f: &mut Formatter<'_>,
_options: &Options,
_indent: usize,
) -> Result
fn fmt_with( &self, f: &mut Formatter<'_>, _options: &Options, _indent: usize, ) -> Result
Writes the value to
f with the given options, starting at the given
indentation level. Read moreSource§fn pretty_print(&self) -> Printed<'_, Self>
fn pretty_print(&self) -> Printed<'_, Self>
Print the value with
Options::pretty options.Source§fn compact_print(&self) -> Printed<'_, Self>
fn compact_print(&self) -> Printed<'_, Self>
Print the value with
Options::compact options.Source§fn inline_print(&self) -> Printed<'_, Self>
fn inline_print(&self) -> Printed<'_, Self>
Print the value with
Options::inline options.Source§fn print_with(&self, options: Options) -> Printed<'_, Self>
fn print_with(&self, options: Options) -> Printed<'_, Self>
Print the value with the given options.
Source§impl Serialize for LenientLangTag
Available on crate feature serde only.
impl Serialize for LenientLangTag
Available on crate feature
serde only.Source§impl ToOwned for LenientLangTag
impl ToOwned for LenientLangTag
Source§type Owned = LenientLangTagBuf
type Owned = LenientLangTagBuf
The resulting type after obtaining ownership.
Source§fn to_owned(&self) -> Self::Owned
fn to_owned(&self) -> Self::Owned
Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · Source§fn clone_into(&self, target: &mut Self::Owned)
fn clone_into(&self, target: &mut Self::Owned)
Uses borrowed data to replace owned data, usually by cloning. Read more
Auto Trait Implementations§
impl !Sized for LenientLangTag
impl Freeze for LenientLangTag
impl RefUnwindSafe for LenientLangTag
impl Send for LenientLangTag
impl Sync for LenientLangTag
impl Unpin for LenientLangTag
impl UnsafeUnpin for LenientLangTag
impl UnwindSafe for LenientLangTag
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
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
Checks if
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
Compare self to
key and return true if they are equal.