pub struct _SoftAsciiStr(_);
Expand description

A str wrapper adding a “is us-ascii” soft constraint.

This means that it should be ascii but is not guaranteed to be ascii. Which means non ascii chars are not a safety issue just a potential bug.

This is useful for situations where:

  1. you would have many unsafe from str conversions/“unnecessary” checks with a strict AsciiStr
  2. you rarely have to strictly rely on the value being ascii

Note

Some functions which should be implemented directly on SoftAsciiStr like e.g. trim_matches are only provided through .as_str(). This is because the Pattern API and SliceIndex API is unstable i.e. can only be implemented in unstable for now. Once it gets stabilized (rust #27721/#35729) implementations can be added

Implementations

👎Deprecated since 1.0.0: use from_unchecked

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.

returns a mutable str reference to the inner buffer

Soft Constraint

be aware that it is very easy to introduce bugs when directly editing a SoftAsciiStr as an str. Still compared to a AsciiStr implementation this won’t introduce unsafety, just possible brakeage of the soft constraint that the data should be ascii.

👎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.
Converts this type into a shared reference of the (usually inferred) input type.
Converts this type into a shared reference of the (usually inferred) input type.
Converts this type into a shared reference of the (usually inferred) input type.
Converts this type into a shared reference of the (usually inferred) input type.
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Formats the value using the given formatter. Read more
Feeds this value into the given Hasher. Read more
The returned type after indexing.
Performs the indexing (container[index]) operation. Read more
The returned type after indexing.
Performs the indexing (container[index]) operation. Read more
The returned type after indexing.
Performs the indexing (container[index]) operation. Read more
The returned type after indexing.
Performs the indexing (container[index]) operation. Read more
This method returns an Ordering between self and other. Read more
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
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
Returned iterator over socket addresses which this type may correspond to. Read more
Converts this object to an iterator of resolved SocketAddrs. 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
Converts the given value to a String. Read more