doc.rust-lang.org
pub fn contains<P>(&self, pat: P) -> bool
Returns true if the given pattern matches a sub-slice of this string slice.
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn chars(&self) -> Chars<'_>
Returns an iterator over the chars of a string slice.
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn char_indices(&self) -> CharIndices<'_>
Returns an iterator over the chars of a string slice, and their positions.
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn ceil_char_boundary(&self, index: usize) -> usize
Finds the closest x not below index where is_char_boundary(x) is true.
method
core
Stable since 1.91.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn bytes(&self) -> Bytes<'_>
Returns an iterator over the bytes of a string slice.
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn as_ptr(&self) -> *const u8
Converts a string slice to a raw pointer.
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn as_mut_ptr(&mut self) -> *mut u8
Converts a mutable string slice to a raw pointer.
method
core
Stable since 1.36.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const unsafe fn as_bytes_mut(&mut self) -> &mut [u8]
Converts a mutable string slice to a mutable byte slice.
method
core
Stable since 1.20.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn as_bytes(&self) -> &[u8]
Converts a string slice to a byte slice. To convert the byte slice back into a string slice, use the from_utf8 function.
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
primitive str
String slices.
primitive
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub mod str
String manipulation.
module
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn write_copy_of_slice(&mut self, src: &[T]) -> &mut [T]
Copies the elements from src to self, returning a mutable reference to the now initialized contents of self.
method
core
Stable since 1.93.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn write_clone_of_slice(&mut self, src: &[T]) -> &mut [T]
Clones the elements from src to self, returning a mutable reference to the now initialized contents of self. Any already initialized elements will not be dropped.
method
core
Stable since 1.93.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn windows(&self, size: usize) -> Windows<'_, T>
Returns an iterator over all contiguous windows of length size. The windows overlap. If the slice is shorter than size, the iterator returns no values.
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn utf8_chunks(&self) -> Utf8Chunks<'_>
Creates an iterator over the contiguous valid UTF-8 ranges of this slice, and the non-UTF-8 fragments in between.
method
core
Stable since 1.79.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn trim_ascii_start(&self) -> &[u8]
Returns a byte slice with leading ASCII whitespace bytes removed.
method
core
Stable since 1.80.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn trim_ascii_end(&self) -> &[u8]
Returns a byte slice with trailing ASCII whitespace bytes removed.
method
core
Stable since 1.80.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn trim_ascii(&self) -> &[u8]
Returns a byte slice with leading and trailing ASCII whitespace bytes removed.
method
core
Stable since 1.80.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn swap_with_slice(&mut self, other: &mut [T])
Swaps all elements in self with those in other.
method
core
Stable since 1.27.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn swap(&mut self, a: usize, b: usize)
Swaps two elements in the slice.
method
core
Stable since 1.0.0
Version 1.100.0-nightly