Struct basic_text::TextSubstr [−][src]
#[repr(transparent)]pub struct TextSubstr(_);
Expand description
Text substring slices.
TextSubstr
is to TextSubstring
as TextStr
is to TextString
. It is
usually used for borrowing, in the form of &TextSubstr
.
Implementations
Converts a slice of bytes to a text string slice.
Converts a string slice to a text string slice.
Converts a mutable slice of bytes to a mutable text string slice.
Converts a mutable string slice to a mutable text string slice.
Converts a slice of bytes to a text string slice without checking that the string contains valid Basic Text.
Safety
This function is unsafe because it does not check that the bytes passed
to it are valid Basic Text. If this constraint is violated, undefined
behavior results, as the rest of this crate assumes that &TextSubstr
s
are valid Basic Text.
Converts a string slice to a text string slice without checking that the string contains valid Basic Text.
Safety
This function is unsafe because it does not check that the bytes passed
to it are valid Basic Text. If this constraint is violated, undefined
behavior results, as the rest of this crate assumes that &TextSubstr
s
are valid Basic Text.
Converts a slice of bytes to a text string slice without checking that the string contains valid Basic Text; mutable version.
Safety
This function is unsafe because it does not check that the bytes passed
to it are valid Basic Text. If this constraint is violated, undefined
behavior results, as the rest of this crate assumes that &TextSubstr
s
are valid Basic Text.
Converts a string slice to a text string slice without checking that the string contains valid Basic Text; mutable version.
Safety
This function is unsafe because it does not check that the string
passed to it is valid Basic Text. If this constraint is violated,
undefined behavior results, as the rest of this crate assumes that
&TextSubstr
s are valid Basic Text.
Converts a boxed slice of bytes to a boxed text string slice without checking that the string contains valid basic text.
Safety
This function is unsafe because it does not check that the bytes passed
to it are valid Basic Text. If this constraint is violated, undefined
behavior results, as the rest of this crate assumes that &TextSubstr
s
are valid Basic Text.
Converts a boxed string slice to a boxed text string slice without checking that the string contains valid basic text.
Safety
This function is unsafe because it does not check that the bytes passed
to it are valid Basic Text. If this constraint is violated, undefined
behavior results, as the rest of this crate assumes that &TextSubstr
s
are valid Basic Text.
Converts a text string slice to a byte slice.
Converts a mutable text string slice to a mutable byte slice.
Safety
The caller must ensure that the content of the slice is valid
Basic Text before the borrow ends and the underlying TextSubstr
is
used.
Use of a TextSubstr
whose contents are not valid Basic Text is
undefined behavior.
Converts a mutable text string slice to a raw pointer.
Divide one text string slice into two at an index.
Divide one mutable text string slice into two at an index.
Returns an iterator over the char
s of a text string slice, and their
positions.
An iterator over the lines of a text string, as text string slices.
TODO: There should be a TextLines
which yields &TextSubstr
s.
Returns an iterator of u16
over the string encoded as Basic Text.
Returns true
if the given pattern matches a sub-slice of this
text string slice.
Returns false
if it does not.
Returns true
if the given pattern matches a prefix of this
text string slice.
Returns false
if it does not.
Returns true
if the given pattern matches a suffix of this
text string slice.
Returns false
if it does not.
Returns the byte index of the first character of this text string slice that matches the pattern.
Returns None
if the pattern doesn’t match.
Returns the byte index for the first character of the rightmost match of the pattern in this text string slice.
Returns None
if the pattern doesn’t match.
An iterator over the disjoint matches of a pattern within the given text string slice.
TODO: There should be a TextMatches
which yields &TextSubstr
s.
An iterator over the disjoint matches of a pattern within this text string slice, yielded in reverse order.
TODO: There should be a TextRMatches
which yields &TextSubstr
s.
An iterator over the disjoint matches of a pattern within this text string slice as well as the index that the match starts at.
TODO: There should be a TextMatchIndices
which yields &TextSubstr
s.
pub fn rmatch_indices<'a, P>(&'a self, pat: P) -> RMatchIndices<'a, P> where
P: Pattern<'a>,
<P as Pattern<'a>>::Searcher: ReverseSearcher<'a>,
pub fn rmatch_indices<'a, P>(&'a self, pat: P) -> RMatchIndices<'a, P> where
P: Pattern<'a>,
<P as Pattern<'a>>::Searcher: ReverseSearcher<'a>,
An iterator over the disjoint matches of a pattern within self
,
yielded in reverse order along with the index of the match.
TODO: There should be a TextRMatchIndices
which yields
&TextSubstr
s.
Returns a text string slice with leading and trailing whitespace removed.
Returns a text string slice with leading whitespace removed.
Parses this text string slice into another type.
Checks if all characters in this text string are within the ASCII range.
Checks that two text strings are an ASCII case-insensitive match.
Converts a Box<TextSubstr
> into a Box<[u8]>
without copying or
allocating.
Converts a Box<TextSubstr>
into a Box<str>
without copying or
allocating.
Converts a Box<TextSubstr>
into a String
without copying or
allocating.
Converts a Box<TextSubstr>
into a TextSubstring
without copying or
allocating.
Creates a new TextSubstring
by repeating a string n
times.
Return an iterator that escapes each char
in self
with
char::escape_debug
.
Return an iterator that escapes each char
in self
with
char::escape_default
.
Return an iterator that escapes each char
in self
with
char::escape_unicode
.
Trait Implementations
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Performs the conversion.
Performs the conversion.
Performs the conversion.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
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
type Owned = TextSubstring
type Owned = TextSubstring
The resulting type after obtaining ownership.
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
type Iter = IntoIter<SocketAddr>
type Iter = IntoIter<SocketAddr>
Returned iterator over socket addresses which this type may correspond to. Read more
Converts this object to an iterator of resolved SocketAddr
s. Read more