[][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]

Deprecated since 1.1.0:

deprecated in std

pub unsafe fn get_unchecked<I>(&self, index: I) -> &SoftAsciiStr where
    I: TempSliceIndexHelper, 
[src]

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
[src]

pub fn to_lowercase(&self) -> SoftAsciiString[src]

pub fn to_uppercase(&self) -> SoftAsciiString[src]

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

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

Deprecated since 1.1.0:

deprecated in std

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

Deprecated since 1.1.0:

deprecated in std

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

pub fn trim_start(&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 AsRef<str> for InnerAscii[src]

impl Clone for InnerAscii[src]

impl Debug for InnerAscii[src]

impl Deref for InnerAscii[src]

type Target = SoftAsciiStr

The resulting type after dereferencing.

impl Eq for InnerAscii[src]

impl From<SoftAsciiString> for InnerAscii[src]

impl Hash for InnerAscii[src]

impl Into<SoftAsciiString> for InnerAscii[src]

impl PartialEq<InnerAscii> for InnerAscii[src]

impl StructuralEq for InnerAscii[src]

Auto Trait Implementations

impl RefUnwindSafe for InnerAscii

impl Send for InnerAscii

impl Sync for InnerAscii

impl Unpin for InnerAscii

impl UnwindSafe for InnerAscii

Blanket Implementations

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

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

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

impl<T> Erased for T[src]

impl<T> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.