Struct soft_ascii_string::SoftAsciiStr[][src]

pub struct SoftAsciiStr(_);

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

Methods

impl SoftAsciiStr
[src]

Deprecated since 1.0.0

: use from_unchecked

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

Important traits for SoftAsciiLines<'a>

Important traits for SoftAsciiSplitWhitespace<'a>

Important traits for SoftAsciiCharIndices<'a>

Important traits for SoftAsciiChars<'a>

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.

impl SoftAsciiStr
[src]

impl SoftAsciiStr
[src]

impl SoftAsciiStr
[src]

impl SoftAsciiStr
[src]

impl SoftAsciiStr
[src]

Trait Implementations

impl Debug for SoftAsciiStr
[src]

Formats the value using the given formatter. Read more

impl PartialEq for SoftAsciiStr
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for SoftAsciiStr
[src]

impl PartialOrd for SoftAsciiStr
[src]

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

impl Ord for SoftAsciiStr
[src]

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl Hash for SoftAsciiStr
[src]

Feeds this value into the given [Hasher]. Read more

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

impl AsRef<SoftAsciiStr> for SoftAsciiStr
[src]

Performs the conversion.

impl AsRef<str> for SoftAsciiStr
[src]

Performs the conversion.

impl AsRef<[u8]> for SoftAsciiStr
[src]

Performs the conversion.

impl<'a> Default for &'a SoftAsciiStr
[src]

Returns the "default value" for a type. Read more

impl Display for SoftAsciiStr
[src]

Formats the value using the given formatter. Read more

impl Index<Range<usize>> for SoftAsciiStr
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl Index<RangeFrom<usize>> for SoftAsciiStr
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl Index<RangeTo<usize>> for SoftAsciiStr
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl Index<RangeFull> for SoftAsciiStr
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl ToOwned for SoftAsciiStr
[src]

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl PartialEq<SoftAsciiString> for SoftAsciiStr
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<'a> PartialEq<SoftAsciiString> for &'a SoftAsciiStr
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl PartialEq<SoftAsciiStr> for String
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl PartialEq<String> for SoftAsciiStr
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<'a> PartialEq<&'a SoftAsciiStr> for String
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<'a> PartialEq<String> for &'a SoftAsciiStr
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<'a> PartialEq<SoftAsciiStr> for str
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl PartialEq<str> for SoftAsciiStr
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<'a> PartialEq<SoftAsciiStr> for Cow<'a, SoftAsciiStr>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<'a> PartialEq<Cow<'a, SoftAsciiStr>> for SoftAsciiStr
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<'a, 'b> PartialEq<&'b SoftAsciiStr> for Cow<'a, SoftAsciiStr>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<'a, 'b> PartialEq<Cow<'a, SoftAsciiStr>> for &'a SoftAsciiStr
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<'a> PartialEq<SoftAsciiStr> for Cow<'a, str>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<'a> PartialEq<Cow<'a, str>> for SoftAsciiStr
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<'a, 'b> PartialEq<&'b SoftAsciiStr> for Cow<'a, str>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<'a, 'b> PartialEq<Cow<'b, str>> for &'a SoftAsciiStr
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl PartialEq<SoftAsciiStr> for OsString
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl PartialEq<OsString> for SoftAsciiStr
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<'a> PartialEq<&'a SoftAsciiStr> for OsString
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<'a> PartialEq<OsString> for &'a SoftAsciiStr
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl PartialEq<SoftAsciiStr> for OsStr
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl PartialEq<OsStr> for SoftAsciiStr
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl AsRef<OsStr> for SoftAsciiStr
[src]

Performs the conversion.

impl AsRef<Path> for SoftAsciiStr
[src]

Performs the conversion.

impl ToSocketAddrs for SoftAsciiStr
[src]

Returned iterator over socket addresses which this type may correspond to. Read more

Converts this object to an iterator of resolved SocketAddrs. Read more

impl<'a> From<&'a SoftAsciiStr> for SoftAsciiChars<'a>
[src]

Important traits for SoftAsciiChars<'a>

Performs the conversion.

impl<'a> From<&'a SoftAsciiStr> for SoftAsciiCharIndices<'a>
[src]

Important traits for SoftAsciiCharIndices<'a>

Performs the conversion.

impl<'a> From<&'a SoftAsciiStr> for SoftAsciiLines<'a>
[src]

Important traits for SoftAsciiLines<'a>

Performs the conversion.

impl<'a> From<&'a SoftAsciiStr> for SoftAsciiSplitWhitespace<'a>
[src]

Important traits for SoftAsciiSplitWhitespace<'a>

Performs the conversion.

impl Borrow<SoftAsciiStr> for SoftAsciiString
[src]

Immutably borrows from an owned value. Read more

impl<'a> AddAssign<&'a SoftAsciiStr> for SoftAsciiString
[src]

Performs the += operation.

impl<'a> Add<&'a SoftAsciiStr> for SoftAsciiString
[src]

The resulting type after applying the + operator.

Performs the + operation.

impl<'a> PartialEq<&'a SoftAsciiStr> for SoftAsciiString
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<'a> FromIterator<&'a SoftAsciiStr> for SoftAsciiString
[src]

Creates a value from an iterator. Read more

impl AsRef<SoftAsciiStr> for SoftAsciiString
[src]

Performs the conversion.

impl<'a> Extend<&'a SoftAsciiStr> for SoftAsciiString
[src]

Extends a collection with the contents of an iterator. Read more

impl<'a> From<&'a SoftAsciiStr> for SoftAsciiString
[src]

Performs the conversion.

Auto Trait Implementations