pub struct SoftAsciiString(/* private fields */);
Expand description
a String
wrapper with an additional “is us-ascii” soft constraint
Implementations§
Source§impl SoftAsciiString
impl SoftAsciiString
pub fn from_unchecked<S: Into<String>>(s: S) -> Self
pub fn from_string_unchecked<S: Into<String>>(s: S) -> Self
👎Deprecated since 1.0.0: use from_unchecked
pub fn from_string<S>(source: S) -> Result<Self, FromSourceError<S>>
pub fn new() -> Self
pub fn with_capacity(cap: usize) -> Self
pub fn revalidate_soft_constraint(self) -> Result<SoftAsciiString, String>
pub fn inner_string_mut(&mut self) -> &mut String
pub fn inner_string(&self) -> &String
pub fn push_str(&mut self, other: &SoftAsciiStr)
pub fn into_bytes(self) -> Vec<u8> ⓘ
pub fn push(&mut self, ch: SoftAsciiChar)
pub fn pop(&mut self) -> Option<SoftAsciiChar>
pub fn remove(&mut self, idx: usize) -> SoftAsciiChar
pub fn insert(&mut self, idx: usize, ch: SoftAsciiChar)
pub fn insert_str(&mut self, idx: usize, string: &SoftAsciiStr)
pub fn as_soft_ascii_str(&self) -> &SoftAsciiStr
pub fn as_soft_ascii_str_mut(&mut self) -> &mut SoftAsciiStr
pub fn split_off(&mut self, at: usize) -> SoftAsciiString
pub fn into_boxed_soft_ascii_str(self) -> Box<SoftAsciiStr>
pub fn into_boxed_str(self) -> Box<str>
pub fn is_ascii(&self) -> bool
Methods from Deref<Target = SoftAsciiStr>§
Sourcepub fn revalidate_soft_constraint(&self) -> Result<&Self, FromSourceError<&str>>
pub fn revalidate_soft_constraint(&self) -> Result<&Self, FromSourceError<&str>>
reruns checks if the “is us-ascii” soft constraint is still valid
pub fn as_str(&self) -> &str
pub fn lines(&self) -> SoftAsciiLines<'_> ⓘ
pub fn split_whitespace(&self) -> SoftAsciiSplitWhitespace<'_> ⓘ
pub fn char_indices(&self) -> SoftAsciiCharIndices<'_> ⓘ
pub fn chars(&self) -> SoftAsciiChars<'_> ⓘ
pub fn split_at(&self, mid: usize) -> (&SoftAsciiStr, &SoftAsciiStr)
pub unsafe fn slice_unchecked(&self, begin: usize, end: usize) -> &SoftAsciiStr
👎Deprecated since 1.1.0: deprecated in std
Sourcepub unsafe fn get_unchecked<I>(&self, index: I) -> &SoftAsciiStrwhere
I: TempSliceIndexHelper,
pub unsafe fn get_unchecked<I>(&self, index: I) -> &SoftAsciiStrwhere
I: TempSliceIndexHelper,
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.
Sourcepub fn inner_str_mut(&mut self) -> &mut str
pub fn inner_str_mut(&mut self) -> &mut str
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.
pub fn parse<F>(&self) -> Result<F, <F as FromStr>::Err>where
F: FromStr,
pub fn to_lowercase(&self) -> SoftAsciiString
pub fn to_uppercase(&self) -> SoftAsciiString
pub fn repeat(&self, n: usize) -> SoftAsciiString
pub fn trim_right(&self) -> &SoftAsciiStr
👎Deprecated since 1.1.0: deprecated in std
pub fn trim_left(&self) -> &SoftAsciiStr
👎Deprecated since 1.1.0: deprecated in std
pub fn trim_end(&self) -> &SoftAsciiStr
pub fn trim_start(&self) -> &SoftAsciiStr
pub fn trim(&self) -> &SoftAsciiStr
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn is_char_boundary(&self, index: usize) -> bool
pub fn as_ptr(&self) -> *const u8
pub fn encode_utf16(&self) -> EncodeUtf16<'_>
pub fn is_ascii(&self) -> bool
pub fn as_bytes(&self) -> &[u8] ⓘ
Trait Implementations§
Source§impl<'a> Add<&'a SoftAsciiStr> for SoftAsciiString
impl<'a> Add<&'a SoftAsciiStr> for SoftAsciiString
Source§type Output = SoftAsciiString
type Output = SoftAsciiString
The resulting type after applying the
+
operator.Source§fn add(self, other: &'a SoftAsciiStr) -> Self
fn add(self, other: &'a SoftAsciiStr) -> Self
Performs the
+
operation. Read moreSource§impl<'a> AddAssign<&'a SoftAsciiStr> for SoftAsciiString
impl<'a> AddAssign<&'a SoftAsciiStr> for SoftAsciiString
Source§fn add_assign(&mut self, other: &'a SoftAsciiStr)
fn add_assign(&mut self, other: &'a SoftAsciiStr)
Performs the
+=
operation. Read moreSource§impl AsRef<[u8]> for SoftAsciiString
impl AsRef<[u8]> for SoftAsciiString
Source§impl AsRef<OsStr> for SoftAsciiString
impl AsRef<OsStr> for SoftAsciiString
Source§impl AsRef<Path> for SoftAsciiString
impl AsRef<Path> for SoftAsciiString
Source§impl AsRef<SoftAsciiStr> for SoftAsciiString
impl AsRef<SoftAsciiStr> for SoftAsciiString
Source§fn as_ref(&self) -> &SoftAsciiStr
fn as_ref(&self) -> &SoftAsciiStr
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl AsRef<str> for SoftAsciiString
impl AsRef<str> for SoftAsciiString
Source§impl Borrow<SoftAsciiStr> for SoftAsciiString
impl Borrow<SoftAsciiStr> for SoftAsciiString
Source§fn borrow(&self) -> &SoftAsciiStr
fn borrow(&self) -> &SoftAsciiStr
Immutably borrows from an owned value. Read more
Source§impl Borrow<str> for SoftAsciiString
impl Borrow<str> for SoftAsciiString
Source§impl Clone for SoftAsciiString
impl Clone for SoftAsciiString
Source§fn clone(&self) -> SoftAsciiString
fn clone(&self) -> SoftAsciiString
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for SoftAsciiString
impl Debug for SoftAsciiString
Source§impl Default for SoftAsciiString
impl Default for SoftAsciiString
Source§fn default() -> SoftAsciiString
fn default() -> SoftAsciiString
Returns the “default value” for a type. Read more
Source§impl Deref for SoftAsciiString
impl Deref for SoftAsciiString
Source§impl DerefMut for SoftAsciiString
impl DerefMut for SoftAsciiString
Source§impl Display for SoftAsciiString
impl Display for SoftAsciiString
Source§impl<'a> Extend<&'a SoftAsciiChar> for SoftAsciiString
impl<'a> Extend<&'a SoftAsciiChar> for SoftAsciiString
Source§fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = &'a SoftAsciiChar>,
fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = &'a SoftAsciiChar>,
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<'a> Extend<&'a SoftAsciiStr> for SoftAsciiString
impl<'a> Extend<&'a SoftAsciiStr> for SoftAsciiString
Source§fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = &'a SoftAsciiStr>,
fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = &'a SoftAsciiStr>,
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<'a> Extend<Cow<'a, SoftAsciiStr>> for SoftAsciiString
impl<'a> Extend<Cow<'a, SoftAsciiStr>> for SoftAsciiString
Source§fn extend<I>(&mut self, iter: I)
fn extend<I>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl Extend<SoftAsciiChar> for SoftAsciiString
impl Extend<SoftAsciiChar> for SoftAsciiString
Source§fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = SoftAsciiChar>,
fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = SoftAsciiChar>,
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl Extend<SoftAsciiString> for SoftAsciiString
impl Extend<SoftAsciiString> for SoftAsciiString
Source§fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = SoftAsciiString>,
fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = SoftAsciiString>,
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<'a> From<&'a SoftAsciiStr> for SoftAsciiString
impl<'a> From<&'a SoftAsciiStr> for SoftAsciiString
Source§fn from(s: &'a SoftAsciiStr) -> Self
fn from(s: &'a SoftAsciiStr) -> Self
Converts to this type from the input type.
Source§impl From<Box<SoftAsciiStr>> for SoftAsciiString
impl From<Box<SoftAsciiStr>> for SoftAsciiString
Source§fn from(b: Box<SoftAsciiStr>) -> SoftAsciiString
fn from(b: Box<SoftAsciiStr>) -> SoftAsciiString
Converts to this type from the input type.
Source§impl<'a> From<Cow<'a, SoftAsciiStr>> for SoftAsciiString
impl<'a> From<Cow<'a, SoftAsciiStr>> for SoftAsciiString
Source§fn from(cow: Cow<'a, SoftAsciiStr>) -> Self
fn from(cow: Cow<'a, SoftAsciiStr>) -> Self
Converts to this type from the input type.
Source§impl<'a> FromIterator<&'a SoftAsciiChar> for SoftAsciiString
impl<'a> FromIterator<&'a SoftAsciiChar> for SoftAsciiString
Source§fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = &'a SoftAsciiChar>,
fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = &'a SoftAsciiChar>,
Creates a value from an iterator. Read more
Source§impl<'a> FromIterator<&'a SoftAsciiStr> for SoftAsciiString
impl<'a> FromIterator<&'a SoftAsciiStr> for SoftAsciiString
Source§fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = &'a SoftAsciiStr>,
fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = &'a SoftAsciiStr>,
Creates a value from an iterator. Read more
Source§impl<'a> FromIterator<Cow<'a, SoftAsciiStr>> for SoftAsciiString
impl<'a> FromIterator<Cow<'a, SoftAsciiStr>> for SoftAsciiString
Source§impl FromIterator<SoftAsciiChar> for SoftAsciiString
impl FromIterator<SoftAsciiChar> for SoftAsciiString
Source§fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = SoftAsciiChar>,
fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = SoftAsciiChar>,
Creates a value from an iterator. Read more
Source§impl FromIterator<SoftAsciiString> for SoftAsciiString
impl FromIterator<SoftAsciiString> for SoftAsciiString
Source§fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = SoftAsciiString>,
fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = SoftAsciiString>,
Creates a value from an iterator. Read more
Source§impl FromStr for SoftAsciiString
impl FromStr for SoftAsciiString
Source§impl Hash for SoftAsciiString
impl Hash for SoftAsciiString
Source§impl Index<RangeFull> for SoftAsciiString
impl Index<RangeFull> for SoftAsciiString
Source§impl IndexMut<RangeFull> for SoftAsciiString
impl IndexMut<RangeFull> for SoftAsciiString
Source§impl Into<String> for SoftAsciiString
impl Into<String> for SoftAsciiString
Source§impl Ord for SoftAsciiString
impl Ord for SoftAsciiString
Source§fn cmp(&self, other: &SoftAsciiString) -> Ordering
fn cmp(&self, other: &SoftAsciiString) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<'a> PartialEq<&'a SoftAsciiStr> for SoftAsciiString
impl<'a> PartialEq<&'a SoftAsciiStr> for SoftAsciiString
Source§impl<'a> PartialEq<&'a str> for SoftAsciiString
impl<'a> PartialEq<&'a str> for SoftAsciiString
Source§impl<'a> PartialEq<Cow<'a, SoftAsciiStr>> for SoftAsciiString
impl<'a> PartialEq<Cow<'a, SoftAsciiStr>> for SoftAsciiString
Source§impl<'a> PartialEq<SoftAsciiString> for &'a SoftAsciiStr
impl<'a> PartialEq<SoftAsciiString> for &'a SoftAsciiStr
Source§impl<'a> PartialEq<SoftAsciiString> for &'a str
impl<'a> PartialEq<SoftAsciiString> for &'a str
Source§impl<'a> PartialEq<SoftAsciiString> for Cow<'a, SoftAsciiStr>
impl<'a> PartialEq<SoftAsciiString> for Cow<'a, SoftAsciiStr>
Source§impl PartialEq<SoftAsciiString> for SoftAsciiStr
impl PartialEq<SoftAsciiString> for SoftAsciiStr
Source§impl PartialEq<SoftAsciiString> for String
impl PartialEq<SoftAsciiString> for String
Source§impl PartialEq<SoftAsciiString> for str
impl PartialEq<SoftAsciiString> for str
Source§impl PartialEq<String> for SoftAsciiString
impl PartialEq<String> for SoftAsciiString
Source§impl PartialEq<str> for SoftAsciiString
impl PartialEq<str> for SoftAsciiString
Source§impl PartialEq for SoftAsciiString
impl PartialEq for SoftAsciiString
Source§impl PartialOrd for SoftAsciiString
impl PartialOrd for SoftAsciiString
Source§impl ToSocketAddrs for SoftAsciiString
impl ToSocketAddrs for SoftAsciiString
Source§type Iter = IntoIter<SocketAddr>
type Iter = IntoIter<SocketAddr>
Returned iterator over socket addresses which this type may correspond
to.
Source§fn to_socket_addrs(&self) -> Result<IntoIter<SocketAddr>>
fn to_socket_addrs(&self) -> Result<IntoIter<SocketAddr>>
Converts this object to an iterator of resolved
SocketAddr
s. Read moreimpl Eq for SoftAsciiString
impl StructuralPartialEq for SoftAsciiString
Auto Trait Implementations§
impl Freeze for SoftAsciiString
impl RefUnwindSafe for SoftAsciiString
impl Send for SoftAsciiString
impl Sync for SoftAsciiString
impl Unpin for SoftAsciiString
impl UnwindSafe for SoftAsciiString
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more