[][src]Enum mail_headers::data::InnerAscii

pub enum InnerAscii {
    Owned(SoftAsciiString),
    Shared(OwningRef<Arc<String>, SoftAsciiStr>),
}

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>)

Methods

impl InnerAscii[src]

pub fn into_shared(self) -> Self[src]

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.

impl InnerAscii[src]

pub fn new<S: Into<SoftAsciiString>>(data: S) -> Self[src]

impl InnerAscii[src]

pub fn as_str(&self) -> &str[src]

Methods from Deref<Target = SoftAsciiStr>

pub fn revalidate_soft_constraint(
    &self
) -> Result<&SoftAsciiStr, FromSourceError<&str>>
[src]

reruns checks if the "is us-ascii" soft constraint is still valid

pub fn as_str(&self) -> &str[src]

pub fn lines(&self) -> SoftAsciiLines[src]

pub fn split_whitespace(&self) -> SoftAsciiSplitWhitespace[src]

pub fn char_indices(&self) -> SoftAsciiCharIndices[src]

pub fn chars(&self) -> SoftAsciiChars[src]

pub fn split_at(&self, mid: usize) -> (&SoftAsciiStr, &SoftAsciiStr)[src]

pub unsafe fn slice_unchecked(&self, begin: usize, end: usize) -> &SoftAsciiStr[src]

pub fn parse<F>(&self) -> Result<F, <F as FromStr>::Err> where
    F: FromStr
[src]

pub fn repeat(&self, n: usize) -> SoftAsciiString[src]

pub fn trim_right(&self) -> &SoftAsciiStr[src]

pub fn trim_left(&self) -> &SoftAsciiStr[src]

pub fn trim(&self) -> &SoftAsciiStr[src]

pub fn len(&self) -> usize[src]

pub fn is_empty(&self) -> bool[src]

pub fn is_char_boundary(&self, index: usize) -> bool[src]

pub fn as_ptr(&self) -> *const u8[src]

pub fn encode_utf16(&self) -> EncodeUtf16[src]

pub fn is_ascii(&self) -> bool[src]

pub fn as_bytes(&self) -> &[u8][src]

Trait Implementations

impl From<SoftAsciiString> for InnerAscii[src]

impl Eq for InnerAscii[src]

impl Into<SoftAsciiString> for InnerAscii[src]

impl AsRef<str> for InnerAscii[src]

impl PartialEq<InnerAscii> for InnerAscii[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl Clone for InnerAscii[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for InnerAscii[src]

impl Hash for InnerAscii[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Deref for InnerAscii[src]

type Target = SoftAsciiStr

The resulting type after dereferencing.

impl Serialize for InnerAscii[src]

impl<'de> Deserialize<'de> for InnerAscii[src]

Auto Trait Implementations

impl Send for InnerAscii

impl Sync for InnerAscii

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Erased for T[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]