pub struct LenientLangTagBuf(/* private fields */);Expand description
Owned language tag that may not be well-formed.
Implementations§
Source§impl LenientLangTagBuf
impl LenientLangTagBuf
Sourcepub fn new(s: String) -> (Self, Option<InvalidLangTag<String>>)
pub fn new(s: String) -> (Self, Option<InvalidLangTag<String>>)
Takes ownership of the given string as a language tag, along with the error produced by validating it, if it is not well-formed.
Sourcepub fn as_lenient_lang_tag_ref(&self) -> &LenientLangTag
pub fn as_lenient_lang_tag_ref(&self) -> &LenientLangTag
Borrows this value as a LenientLangTag.
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Unwraps the underlying string.
Sourcepub fn into_well_formed(self) -> Result<LangTagBuf, InvalidLangTag<String>>
pub fn into_well_formed(self) -> Result<LangTagBuf, InvalidLangTag<String>>
Converts this tag into a well-formed LangTagBuf, failing if it is
not well-formed.
§Errors
Returns the string unchanged when it is not a well-formed language tag.
Methods from Deref<Target = LenientLangTag>§
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 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 Clone for LenientLangTagBuf
impl Clone for LenientLangTagBuf
Source§impl Debug for LenientLangTagBuf
impl Debug for LenientLangTagBuf
Source§impl Deref for LenientLangTagBuf
impl Deref for LenientLangTagBuf
Source§impl<'de> Deserialize<'de> for LenientLangTagBuf
Available on crate feature serde only.
impl<'de> Deserialize<'de> for LenientLangTagBuf
Available on crate feature
serde only.Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for LenientLangTagBuf
impl Display for LenientLangTagBuf
impl Eq for LenientLangTagBuf
Source§impl From<LangTagBuf> for LenientLangTagBuf
impl From<LangTagBuf> for LenientLangTagBuf
Source§fn from(tag: LangTagBuf) -> Self
fn from(tag: LangTagBuf) -> Self
Converts to this type from the input type.
Source§impl From<String> for LenientLangTagBuf
impl From<String> for LenientLangTagBuf
Source§impl Hash for LenientLangTagBuf
impl Hash for LenientLangTagBuf
Source§impl IntoJson for LenientLangTagBuf
impl IntoJson for LenientLangTagBuf
Source§impl Ord for LenientLangTagBuf
impl Ord for LenientLangTagBuf
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 LenientLangTagBuf
impl PartialEq for LenientLangTagBuf
Source§impl PartialOrd for LenientLangTagBuf
impl PartialOrd for LenientLangTagBuf
Source§impl PrecomputeSize for LenientLangTagBuf
impl PrecomputeSize for LenientLangTagBuf
Source§impl Print for LenientLangTagBuf
impl Print for LenientLangTagBuf
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 LenientLangTagBuf
Available on crate feature serde only.
impl Serialize for LenientLangTagBuf
Available on crate feature
serde only.Source§impl TryFromJson for LenientLangTagBuf
impl TryFromJson for LenientLangTagBuf
Source§type Error = InvalidContext
type Error = InvalidContext
Error raised when the JSON value does not describe a valid
Self.Source§fn try_from_json(value: &Value) -> Result<Self, InvalidContext>
fn try_from_json(value: &Value) -> Result<Self, InvalidContext>
Builds a value of this type from the given JSON value. Read more
Auto Trait Implementations§
impl Freeze for LenientLangTagBuf
impl RefUnwindSafe for LenientLangTagBuf
impl Send for LenientLangTagBuf
impl Sync for LenientLangTagBuf
impl Unpin for LenientLangTagBuf
impl UnsafeUnpin for LenientLangTagBuf
impl UnwindSafe for LenientLangTagBuf
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
Source§impl<T> BorrowUnordered for T
impl<T> BorrowUnordered for T
Source§fn as_unordered(&self) -> &Unordered<T>
fn as_unordered(&self) -> &Unordered<T>
Views this value as an
Unordered reference.impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
impl<T, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more