Struct aliri_braid_examples::normalized::LowerStr
source · #[repr(transparent)]pub struct LowerStr(_);
Expand description
A borrowed reference to a non-empty, lowercase string
Implementations§
source§impl LowerStr
impl LowerStr
sourcepub fn from_normalized_str(
raw: &str
) -> Result<&Self, <LowerString as Validator>::Error>
pub fn from_normalized_str( raw: &str ) -> Result<&Self, <LowerString as Validator>::Error>
Transparently reinterprets the string slice as a strongly-typed LowerStr
if it conforms to LowerString
, 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 LowerStr
without validating
Safety
Calls to this function must ensure that the value being passed conforms to LowerString
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 LowerStr if it conforms to LowerString
, 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>, <LowerString as Validator>::Error>
pub fn from_str( raw: &str ) -> Result<Cow<'_, Self>, <LowerString as Validator>::Error>
Transparently reinterprets the string slice as a strongly-typed LowerStr if it conforms to LowerString
, normalizing if necessary
sourcepub fn into_owned(self: Box<LowerStr>) -> LowerString
pub fn into_owned(self: Box<LowerStr>) -> LowerString
Converts a Box<LowerStr>
into a LowerString
without copying or allocating
Trait Implementations§
source§impl AsRef<LowerStr> for LowerString
impl AsRef<LowerStr> for LowerString
source§impl Borrow<LowerStr> for LowerString
impl Borrow<LowerStr> for LowerString
source§impl<'de: 'a, 'a> Deserialize<'de> for &'a LowerStr
impl<'de: 'a, 'a> Deserialize<'de> for &'a LowerStr
Deserializes a LowerStr
in normalized form
This deserializer requires that the value already be in normalized form. If values may require normalization, then deserialized as LowerString
or Cow<LowerStr>
instead.
source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
source§impl<'de> Deserialize<'de> for Box<LowerStr>
impl<'de> Deserialize<'de> for Box<LowerStr>
source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
source§impl From<&LowerStr> for LowerString
impl From<&LowerStr> for LowerString
source§impl From<LowerString> for Box<LowerStr>
impl From<LowerString> for Box<LowerStr>
source§fn from(r: LowerString) -> Self
fn from(r: LowerString) -> Self
source§impl PartialEq<&LowerStr> for LowerString
impl PartialEq<&LowerStr> for LowerString
source§impl PartialEq<LowerStr> for LowerStr
impl PartialEq<LowerStr> for LowerStr
source§impl PartialEq<LowerStr> for LowerString
impl PartialEq<LowerStr> for LowerString
source§impl PartialEq<LowerString> for &LowerStr
impl PartialEq<LowerString> for &LowerStr
source§fn eq(&self, other: &LowerString) -> bool
fn eq(&self, other: &LowerString) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<LowerString> for LowerStr
impl PartialEq<LowerString> for LowerStr
source§fn eq(&self, other: &LowerString) -> bool
fn eq(&self, other: &LowerString) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<LowerStr> for LowerStr
impl PartialOrd<LowerStr> for LowerStr
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more