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

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.

Methods from Deref<Target = SoftAsciiStr>

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

👎Deprecated since 1.1.0: deprecated in std

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.

👎Deprecated since 1.1.0: deprecated in std
👎Deprecated since 1.1.0: deprecated in std

Trait Implementations

Converts this type into a shared reference of the (usually inferred) input type.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
The resulting type after dereferencing.
Dereferences the value.
Converts to this type from the input type.
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
Converts this type into the (usually inferred) input type.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.