pub struct LowerCompactStr(/* private fields */);Expand description
A borrowed reference to a non-empty, lowercase string
Implementations§
Source§impl LowerCompactStr
impl LowerCompactStr
Sourcepub fn from_normalized_str(
raw: &str,
) -> Result<&Self, <LowerCompactString as Validator>::Error>
pub fn from_normalized_str( raw: &str, ) -> Result<&Self, <LowerCompactString as Validator>::Error>
Transparently reinterprets the string slice as a strongly-typed LowerCompactStr if it conforms to LowerCompactString, producing an error if normalization is necessary
Sourcepub const unsafe fn from_str_unchecked(raw: &str) -> &Self
pub const unsafe fn from_str_unchecked(raw: &str) -> &Self
Transparently reinterprets the string slice as a strongly-typed LowerCompactStr without validating
§Safety
Calls to this function must ensure that the value being passed conforms to LowerCompactString and is already in normalized form. Failure to do this may result in undefined behavior if other code relies on this invariant.
Sourcepub fn from_static(raw: &'static str) -> &'static Self
pub fn from_static(raw: &'static str) -> &'static Self
Transparently reinterprets a static string slice as a strongly-typed LowerCompactStr if it conforms to LowerCompactString, normalizing if necessary
§Panics
This function will panic if the provided raw string is not normalized.
Sourcepub fn from_str(
raw: &str,
) -> Result<Cow<'_, Self>, <LowerCompactString as Validator>::Error>
pub fn from_str( raw: &str, ) -> Result<Cow<'_, Self>, <LowerCompactString as Validator>::Error>
Transparently reinterprets the string slice as a strongly-typed LowerCompactStr if it conforms to LowerCompactString, normalizing if necessary
Sourcepub fn into_owned(self: Box<LowerCompactStr>) -> LowerCompactString
pub fn into_owned(self: Box<LowerCompactStr>) -> LowerCompactString
Converts a Box<LowerCompactStr> into a LowerCompactString without copying or allocating
Trait Implementations§
Source§impl AsRef<LowerCompactStr> for LowerCompactString
impl AsRef<LowerCompactStr> for LowerCompactString
Source§fn as_ref(&self) -> &LowerCompactStr
fn as_ref(&self) -> &LowerCompactStr
Source§impl AsRef<str> for LowerCompactStr
impl AsRef<str> for LowerCompactStr
Source§impl Borrow<LowerCompactStr> for LowerCompactString
impl Borrow<LowerCompactStr> for LowerCompactString
Source§fn borrow(&self) -> &LowerCompactStr
fn borrow(&self) -> &LowerCompactStr
Source§impl Debug for LowerCompactStr
impl Debug for LowerCompactStr
Source§impl<'de: 'a, 'a> Deserialize<'de> for &'a LowerCompactStr
Deserializes a LowerCompactStr in normalized form
impl<'de: 'a, 'a> Deserialize<'de> for &'a LowerCompactStr
Deserializes a LowerCompactStr in normalized form
This deserializer requires that the value already be in normalized form. If values may require normalization, then deserialized as LowerCompactString or Cow<LowerCompactStr> instead.