pub struct LowerString(/* private fields */);Expand description
A non-empty String normalized to lowercase
This type maintains an invariant that ensures that a value of this type cannot be constructed that contains invalid data. Data that can be normalized to a valid instance of this type will be.
Because this type does normalization, the type explicitly
does not implement Borrow<str>,
as doing so would could violate the contract of that trait,
potentially resulting in lost data. If a user of
the crate would like to override this, then they can
explicitly implement the trait.
This type includes an explicit parameter indicating that
the borrowed form of this type should be named LowerStr.
Implementations§
Source§impl LowerString
impl LowerString
Sourcepub fn new(raw: String) -> Result<Self, <LowerString as Validator>::Error>
pub fn new(raw: String) -> Result<Self, <LowerString as Validator>::Error>
Constructs a new LowerString if it conforms to LowerString and normalizes the input
Sourcepub const unsafe fn new_unchecked(raw: String) -> Self
pub const unsafe fn new_unchecked(raw: String) -> Self
Constructs a new LowerString without validation or normalization
§Safety
Consumers of this function must ensure that values conform to LowerString and are in normalized form. Failure to maintain this invariant may lead to undefined behavior.
Sourcepub fn from_static(raw: &'static str) -> Self
pub fn from_static(raw: &'static str) -> Self
Constructs a new LowerString from a static reference if it conforms to LowerString, normalizing the input
§Panics
This function will panic if the provided raw string is not valid.
Sourcepub fn into_boxed_ref(self) -> Box<LowerStr>
pub fn into_boxed_ref(self) -> Box<LowerStr>
Converts this LowerString into a Box<LowerStr>
This will drop any excess capacity.
Trait Implementations§
Source§impl AsRef<LowerStr> for LowerString
impl AsRef<LowerStr> for LowerString
Source§impl AsRef<str> for LowerString
impl AsRef<str> for LowerString
Source§impl Borrow<LowerStr> for LowerString
impl Borrow<LowerStr> for LowerString
Source§impl Clone for LowerString
impl Clone for LowerString
Source§fn clone(&self) -> LowerString
fn clone(&self) -> LowerString
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LowerString
impl Debug for LowerString
Source§impl Deref for LowerString
impl Deref for LowerString
Source§impl<'de> Deserialize<'de> for LowerString
impl<'de> Deserialize<'de> for LowerString
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 Display for LowerString
impl Display for LowerString
Source§impl<'ʄ> Facet<'ʄ> for LowerString
impl<'ʄ> Facet<'ʄ> for LowerString
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<'a> From<LowerString> for Cow<'a, LowerStr>
impl<'a> From<LowerString> for Cow<'a, LowerStr>
Source§fn from(owned: LowerString) -> Self
fn from(owned: LowerString) -> Self
Source§impl From<LowerString> for String
impl From<LowerString> for String
Source§fn from(s: LowerString) -> Self
fn from(s: LowerString) -> Self
Source§impl FromStr for LowerString
impl FromStr for LowerString
Source§impl Hash for LowerString
impl Hash for LowerString
Source§impl Normalizer for LowerString
impl Normalizer for LowerString
Source§impl Ord for LowerString
impl Ord for LowerString
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq<&LowerStr> for LowerString
impl PartialEq<&LowerStr> for LowerString
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 PartialEq for LowerString
impl PartialEq for LowerString
Source§fn eq(&self, other: &LowerString) -> bool
fn eq(&self, other: &LowerString) -> bool
self and other values to be equal, and is used by ==.