Skip to main content

Module str

Module str 

1.36.0 ยท Source
Expand description

Utilities for the str primitive type.

See also the str primitive type.

Re-exportsยง

use core::borrow::Borrow; ๐Ÿ”’
use core::borrow::BorrowMut; ๐Ÿ”’
use core::iter::FusedIterator; ๐Ÿ”’
use core::mem::MaybeUninit; ๐Ÿ”’
use core::str::pattern::DoubleEndedSearcher; ๐Ÿ”’ Experimental
use core::str::pattern::Pattern; ๐Ÿ”’ Experimental
use core::str::pattern::ReverseSearcher; ๐Ÿ”’ Experimental
use core::str::pattern::Searcher; ๐Ÿ”’ Experimental
use core::str::pattern::Utf8Pattern; ๐Ÿ”’ Experimental
use core::unicode::conversions; ๐Ÿ”’ Experimental
use core::mem; ๐Ÿ”’
use core::ptr; ๐Ÿ”’
use crate::borrow::ToOwned; ๐Ÿ”’
use crate::boxed::Box; ๐Ÿ”’
use crate::slice::Concat; ๐Ÿ”’ Experimental
use crate::slice::Join; ๐Ÿ”’ Experimental
use crate::slice::SliceIndex; ๐Ÿ”’
use crate::string::String; ๐Ÿ”’
use crate::vec::Vec; ๐Ÿ”’

Modulesยง

patternExperimental
The string Pattern API.

Macrosยง

copy_slice_and_advance ๐Ÿ”’
specialize_for_lengths ๐Ÿ”’

Structsยง

Bytes
An iterator over the bytes of a string slice.
CharIndices
An iterator over the chars of a string slice, and their positions.
Chars
An iterator over the chars of a string slice.
EncodeUtf16
An iterator of u16 over the string encoded as UTF-16.
EscapeDebug
The return type of str::escape_debug.
EscapeDefault
The return type of str::escape_default.
EscapeUnicode
The return type of str::escape_unicode.
Lines
An iterator over the lines of a string, as string slices.
LinesAnyDeprecated
Created with the method lines_any.
MatchIndices
Created with the method match_indices.
Matches
Created with the method matches.
ParseBoolError
An error returned when parsing a bool using from_str fails
RMatchIndices
Created with the method rmatch_indices.
RMatches
Created with the method rmatches.
RSplit
Created with the method rsplit.
RSplitN
Created with the method rsplitn.
RSplitTerminator
Created with the method rsplit_terminator.
Split
Created with the method split.
SplitAsciiWhitespace
An iterator over the non-ASCII-whitespace substrings of a string, separated by any amount of ASCII whitespace.
SplitInclusive
An iterator over the substrings of a string, terminated by a substring matching to a predicate function. Unlike Split, it contains the matched part as a terminator of the subslice.
SplitN
Created with the method splitn.
SplitTerminator
Created with the method split_terminator.
SplitWhitespace
An iterator over the non-whitespace substrings of a string, separated by any amount of whitespace.
Utf8Chunk
An item returned by the Utf8Chunks iterator.
Utf8Chunks
An iterator used to decode a slice of mostly UTF-8 bytes to string slices (&str) and byte slices (&[u8]).
Utf8Error
Errors which can occur when attempting to interpret a sequence of u8 as a string.

Traitsยง

FromStr
Parse a value from a string

Functionsยง

from_boxed_utf8_uncheckedโš 
Converts a boxed slice of bytes to a boxed string slice without checking that the string contains valid UTF-8.
from_boxed_utf8_unchecked_in ๐Ÿ”’ โš 
Internal; same as from_boxed_utf8_unchecked but allocator-generic. Name probably not suitable for being made pub as-is.
from_utf8
Converts a slice of bytes to a string slice.
from_utf8_mut
Converts a mutable slice of bytes to a mutable string slice.
from_utf8_uncheckedโš 
Converts a slice of bytes to a string slice without checking that the string contains valid UTF-8.
from_utf8_unchecked_mutโš 
Converts a slice of bytes to a string slice without checking that the string contains valid UTF-8; mutable version.
join_generic_copy ๐Ÿ”’
map_uppercase_sigma ๐Ÿ”’
Helper for final sigma lowercase
replace_ascii ๐Ÿ”’ โš 
Faster implementation of string replacement for ASCII to ASCII cases. Should produce fast vectorized code.
convert_while_ascii ๐Ÿ‘ป โš Experimental
Converts leading ascii bytes in s by calling the convert function.
from_raw_partsโš Experimental
Creates a &str from a pointer and a length.
from_raw_parts_mutโš Experimental
Creates a &mut str from a pointer and a length.