Trait core::str::StrExt
[−]
[src]
pub trait StrExt { fn contains<'a, P: Pattern<'a>>(&'a self, pat: P) -> bool; fn chars(&self) -> Chars; fn bytes(&self) -> Bytes; fn char_indices(&self) -> CharIndices; fn split<'a, P: Pattern<'a>>(&'a self, pat: P) -> Split<'a, P>; fn rsplit<'a, P: Pattern<'a>>(&'a self, pat: P) -> RSplit<'a, P> where P::Searcher: ReverseSearcher<'a>; fn splitn<'a, P: Pattern<'a>>(&'a self, count: usize, pat: P) -> SplitN<'a, P>; fn rsplitn<'a, P: Pattern<'a>>(&'a self, count: usize, pat: P) -> RSplitN<'a, P> where P::Searcher: ReverseSearcher<'a>; fn split_terminator<'a, P: Pattern<'a>>(&'a self, pat: P) -> SplitTerminator<'a, P>; fn rsplit_terminator<'a, P: Pattern<'a>>(&'a self, pat: P) -> RSplitTerminator<'a, P> where P::Searcher: ReverseSearcher<'a>; fn matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> Matches<'a, P>; fn rmatches<'a, P: Pattern<'a>>(&'a self, pat: P) -> RMatches<'a, P> where P::Searcher: ReverseSearcher<'a>; fn match_indices<'a, P: Pattern<'a>>(&'a self, pat: P) -> MatchIndices<'a, P>; fn rmatch_indices<'a, P: Pattern<'a>>(&'a self, pat: P) -> RMatchIndices<'a, P> where P::Searcher: ReverseSearcher<'a>; fn lines(&self) -> Lines; fn lines_any(&self) -> LinesAny; unsafe fn slice_unchecked(&self, begin: usize, end: usize) -> &str; unsafe fn slice_mut_unchecked(&mut self, begin: usize, end: usize) -> &mut str; fn starts_with<'a, P: Pattern<'a>>(&'a self, pat: P) -> bool; fn ends_with<'a, P: Pattern<'a>>(&'a self, pat: P) -> bool where P::Searcher: ReverseSearcher<'a>; fn trim_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str where P::Searcher: DoubleEndedSearcher<'a>; fn trim_left_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str; fn trim_right_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str where P::Searcher: ReverseSearcher<'a>; fn is_char_boundary(&self, index: usize) -> bool; fn char_range_at(&self, start: usize) -> CharRange; fn char_range_at_reverse(&self, start: usize) -> CharRange; fn char_at(&self, i: usize) -> char; fn char_at_reverse(&self, i: usize) -> char; fn as_bytes(&self) -> &[u8]; fn find<'a, P: Pattern<'a>>(&'a self, pat: P) -> Option<usize>; fn rfind<'a, P: Pattern<'a>>(&'a self, pat: P) -> Option<usize> where P::Searcher: ReverseSearcher<'a>; fn find_str<'a, P: Pattern<'a>>(&'a self, pat: P) -> Option<usize>; fn split_at(&self, mid: usize) -> (&str, &str); fn split_at_mut(&mut self, mid: usize) -> (&mut str, &mut str); fn slice_shift_char(&self) -> Option<(char, &str)>; fn as_ptr(&self) -> *const u8; fn len(&self) -> usize; fn is_empty(&self) -> bool; fn parse<T: FromStr>(&self) -> Result<T, T::Err>; }
Methods for string slices
Required Methods
fn contains<'a, P: Pattern<'a>>(&'a self, pat: P) -> bool
fn chars(&self) -> Chars
fn bytes(&self) -> Bytes
fn char_indices(&self) -> CharIndices
fn split<'a, P: Pattern<'a>>(&'a self, pat: P) -> Split<'a, P>
fn rsplit<'a, P: Pattern<'a>>(&'a self, pat: P) -> RSplit<'a, P> where P::Searcher: ReverseSearcher<'a>
fn splitn<'a, P: Pattern<'a>>(&'a self, count: usize, pat: P) -> SplitN<'a, P>
fn rsplitn<'a, P: Pattern<'a>>(&'a self, count: usize, pat: P) -> RSplitN<'a, P> where P::Searcher: ReverseSearcher<'a>
fn split_terminator<'a, P: Pattern<'a>>(&'a self, pat: P) -> SplitTerminator<'a, P>
fn rsplit_terminator<'a, P: Pattern<'a>>(&'a self, pat: P) -> RSplitTerminator<'a, P> where P::Searcher: ReverseSearcher<'a>
fn matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> Matches<'a, P>
fn rmatches<'a, P: Pattern<'a>>(&'a self, pat: P) -> RMatches<'a, P> where P::Searcher: ReverseSearcher<'a>
fn match_indices<'a, P: Pattern<'a>>(&'a self, pat: P) -> MatchIndices<'a, P>
fn rmatch_indices<'a, P: Pattern<'a>>(&'a self, pat: P) -> RMatchIndices<'a, P> where P::Searcher: ReverseSearcher<'a>
fn lines(&self) -> Lines
fn lines_any(&self) -> LinesAny
: use lines() instead now
unsafe fn slice_unchecked(&self, begin: usize, end: usize) -> &str
unsafe fn slice_mut_unchecked(&mut self, begin: usize, end: usize) -> &mut str
fn starts_with<'a, P: Pattern<'a>>(&'a self, pat: P) -> bool
fn ends_with<'a, P: Pattern<'a>>(&'a self, pat: P) -> bool where P::Searcher: ReverseSearcher<'a>
fn trim_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str where P::Searcher: DoubleEndedSearcher<'a>
fn trim_left_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str
fn trim_right_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str where P::Searcher: ReverseSearcher<'a>
fn is_char_boundary(&self, index: usize) -> bool
str_char
#27754): it is unclear whether this method pulls its weight with the existence of the char_indices iterator or this method may want to be replaced with checked slicing
fn char_range_at(&self, start: usize) -> CharRange
str_char
#27754): often replaced by char_indices, this method may be removed in favor of just char_at() or eventually removed altogether
fn char_range_at_reverse(&self, start: usize) -> CharRange
str_char
#27754): often replaced by char_indices, this method may be removed in favor of just char_at_reverse() or eventually removed altogether
fn char_at(&self, i: usize) -> char
str_char
#27754): frequently replaced by the chars() iterator, this method may be removed or possibly renamed in the future; it is normally replaced by chars/char_indices iterators or by getting the first char from a subslice
fn char_at_reverse(&self, i: usize) -> char
str_char
#27754): see char_at for more details, but reverse semantics are also somewhat unclear, especially with which cases generate panics
fn as_bytes(&self) -> &[u8]
fn find<'a, P: Pattern<'a>>(&'a self, pat: P) -> Option<usize>
fn rfind<'a, P: Pattern<'a>>(&'a self, pat: P) -> Option<usize> where P::Searcher: ReverseSearcher<'a>
fn find_str<'a, P: Pattern<'a>>(&'a self, pat: P) -> Option<usize>
fn split_at(&self, mid: usize) -> (&str, &str)
fn split_at_mut(&mut self, mid: usize) -> (&mut str, &mut str)
fn slice_shift_char(&self) -> Option<(char, &str)>
str_char
#27754): awaiting conventions about shifting and slices and may not be warranted with the existence of the chars and/or char_indices iterators
fn as_ptr(&self) -> *const u8
fn len(&self) -> usize
fn is_empty(&self) -> bool
fn parse<T: FromStr>(&self) -> Result<T, T::Err>
Implementors
impl StrExt for str