Enum mail_headers::data::InnerAscii
source · pub enum InnerAscii {
Owned(SoftAsciiString),
Shared(OwningRef<Arc<String>, SoftAsciiStr>),
}Expand description
InnerAscii is string data container which can contain either a
owned SoftAsciiString or a SoftAsciiStr reference into a shared
string buffer.
Variants
Owned(SoftAsciiString)
Shared(OwningRef<Arc<String>, SoftAsciiStr>)
Implementations
sourceimpl InnerAscii
impl InnerAscii
converts this container into on which uses underlying shared data
if the data is already shared nothing is done.
If not the owned data is converted into the underlying string buffer
and OwningRef is used to enable the shared reference
Note that the underlying buffer is no an SoftAsciiString but a
String (from which we happend to know that it fulfills the “is
us-ascii” soft constraint). This allows us to have an InnerAscii
share data with a possible non us-ascii string buffer as long as
the part accessable through the SoftAsciiStr is ascii. Or at last
should be ascii as it’s a soft constraint.
sourceimpl InnerAscii
impl InnerAscii
pub fn new<S: Into<SoftAsciiString>>(data: S) -> Self
sourceimpl InnerAscii
impl InnerAscii
Methods from Deref<Target = SoftAsciiStr>
sourcepub fn revalidate_soft_constraint(
&self
) -> Result<&SoftAsciiStr, FromSourceError<&str>>
pub fn revalidate_soft_constraint(
&self
) -> Result<&SoftAsciiStr, FromSourceError<&str>>
reruns checks if the “is us-ascii” soft constraint is still valid
pub fn as_str(&self) -> &str
pub fn lines(&self) -> SoftAsciiLines<'_>
pub fn split_whitespace(&self) -> SoftAsciiSplitWhitespace<'_>
pub fn char_indices(&self) -> SoftAsciiCharIndices<'_>
pub fn chars(&self) -> SoftAsciiChars<'_>
pub fn split_at(&self, mid: usize) -> (&SoftAsciiStr, &SoftAsciiStr)
pub unsafe fn slice_unchecked(&self, begin: usize, end: usize) -> &SoftAsciiStr
sourcepub unsafe fn get_unchecked<I>(&self, index: I) -> &SoftAsciiStrwhere
I: TempSliceIndexHelper,
pub unsafe fn get_unchecked<I>(&self, index: I) -> &SoftAsciiStrwhere
I: TempSliceIndexHelper,
Proxy of std::str::get_unchecked.
Currently limited to the various range types:
Range<usize>RangeInclusive<usize>RangeFrom<usize>RangeTo<usize>RangeToInclusive<usize>RangeFull
Once all methods on SliceIndex are stable this
can be implemented using SliceIndex<SoftAsciiStr>
bounds.
pub fn parse<F>(&self) -> Result<F, <F as FromStr>::Err>where
F: FromStr,
pub fn to_lowercase(&self) -> SoftAsciiString
pub fn to_uppercase(&self) -> SoftAsciiString
pub fn repeat(&self, n: usize) -> SoftAsciiString
pub fn trim_right(&self) -> &SoftAsciiStr
pub fn trim_left(&self) -> &SoftAsciiStr
pub fn trim_end(&self) -> &SoftAsciiStr
pub fn trim_start(&self) -> &SoftAsciiStr
pub fn trim(&self) -> &SoftAsciiStr
Trait Implementations
sourceimpl AsRef<str> for InnerAscii
impl AsRef<str> for InnerAscii
sourceimpl Clone for InnerAscii
impl Clone for InnerAscii
sourcefn clone(&self) -> InnerAscii
fn clone(&self) -> InnerAscii
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more