Option<T>
To inner type
- fn unwrap () -> T
- fn unwrap_or (T) -> T
- fn unwrap_or_else (() -> T) -> T
- fn unwrap_or_default () -> T where T: Default
- fn expect (&str) -> T
Converting to another type
- fn map ((T) -> U) -> Option<U>
- fn map_or (U, (T) -> U) -> U
- fn map_or_else (() -> U, (T) -> U) -> U
To Result
- fn ok_or (E) -> Result<T, E>
- fn ok_or_else (() -> E) -> Result<T, E>
Conditioning
- fn filter ((&T) -> bool) -> Option<T>
- fn and (Option<U>) -> Option<U>
- fn and_then ((T) -> Option<U>) -> Option<U>
- fn or (Option<T>) -> Option<T>
- fn or_else (() -> Option<T>) -> Option<T>
- fn xor (Option<T>) -> Option<T>
Option<&T>
Cloning inner
Option<Option<T>>
Option<Result<T, E>>
&Option<T>
Checking inner
To inner reference
- fn as_ref () -> Option<&T>
- fn iter () -> Iterator<&T>
- fn as_deref () -> Option<&U> where T: Deref<Target = U>
&mut Option<T>
To inner mutable reference
- fn as_mut () -> Option<&mut T>
- fn iter_mut () -> Iterator<&mut T>
- fn as_deref_mut () -> Option<&mut U> where T: DerefMut + Deref<Target = U>
Mutation
- fn take () -> Option<T>
- fn replace (T) -> Option<T>
- fn insert (T) -> &mut T
- fn get_or_insert (T) -> &mut T
- fn get_or_insert_with (() -> T) -> &mut T
Result<T, E>
To inner type
- fn unwrap () -> T where E: Debug
- fn unwrap_err () -> E where T: Debug
- fn unwrap_or (T) -> T
- fn unwrap_or_else ((E) -> T) -> T
- fn unwrap_or_default () -> T where T: Default
- fn expect (&str) -> T
- fn expect_err (&str) -> E
- fn ok () -> Option<T>
- fn err () -> Option<E>
Mapping
- fn map ((T) -> U) -> Result<U, E>
- fn map_err ((E) -> F) -> Result<T, F>
- fn map_or (U, (T) -> U) -> U
- fn map_or_else ((E) -> U, (T) -> U) -> U
Conditioning
- fn and (Result<U, E>) -> Result<U, E>
- fn and_then ((T) -> Result<U, E>) -> Result<U, E>
- fn or (Result<T, F>) -> Result<T, F>
- fn or_else ((E) -> Result<T, F>) -> Result<T, F>
Result<Option<T>, E>
Transposing
&Result<T, E>
Checking inner
To inner reference
&mut Result<T, E>
To inner mutable reference
Iterator<Item = T>
Mapping and filtering
- fn map (( T) -> U) -> Iterator<Item = U>
- fn filter ((&T) -> bool) -> Iterator<Item = T>
- fn filter_map (( T) -> Option<U>) -> Iterator<Item = U>
Collecting and folding
- fn fold (S, (S, T) -> S) -> S
- fn collect () -> B where B: FromIterator<T>
- fn partition ((&T) -> bool) -> (B, B) where B: Default + Extend<T>
Counting and enumerating
Combining with other iterators
- fn zip (IntoIterator<Item = U>) -> Iterator<Item = (T, U)>
- fn chain (IntoIterator<Item = T>) -> Iterator<Item = T>
Flattening
- fn flatten () -> Iterator<U> where T: IntoIterator<U>
- fn flat_map ((T) -> IntoIterator<Item = U>) -> Iterator<Item = U>
Taking and skipping
- fn skip (usize) -> Iterator<Item = T>
- fn take (usize) -> Iterator<Item = T>
- fn skip_while ((&T) -> bool) -> Iterator<Item = T>
- fn take_while ((&T) -> bool) -> Iterator<Item = T>
- fn step_by (usize) -> Iterator<Item = T>
Misc. iterating
- fn for_each ((T) -> ()) -> ()
- fn inspect ((&T) -> ()) -> Iterator<Item = T>
- fn scan (S, (&mut S, T) -> Option<U>) -> Iterator<Item = U>
Calculations
Maximum and minimum
- fn max () -> Option<T> where T: Ord
- fn min () -> Option<T> where T: Ord
- fn max_by ((&T, &T) -> Ordering) -> Option<T>
- fn min_by ((&T, &T) -> Ordering) -> Option<T>
- fn max_by_key ((&T) -> U) -> Option<T> where U: Ord
- fn min_by_key ((&T) -> U) -> Option<T> where U: Ord
Comparing with another iterator
- fn eq (IntoIterator<Item = T>) -> bool where T: PartialEq
- fn ne (IntoIterator<Item = T>) -> bool where T: PartialEq
- fn lt (IntoIterator<Item = T>) -> bool where T: PartialOrd
- fn le (IntoIterator<Item = T>) -> bool where T: PartialOrd
- fn gt (IntoIterator<Item = T>) -> bool where T: PartialOrd
- fn ge (IntoIterator<Item = T>) -> bool where T: PartialOrd
- fn cmp (IntoIterator<Item = T>) -> Ordering where T: Ord
- fn partial_cmp (IntoIterator<Item = T>) -> Option<Ordering> where T: PartialOrd
Reversing and cycling
- fn rev () -> Iterator<Item = T> where Self: DoubleEndedIterator
- fn cycle () -> Iterator<Item = T> where Self: Clone
Iterator<Item = &T>
Cloning inner
&mut Iterator<Item = T>
Finding and positioning
- fn find ((&T) -> bool) -> Option<T>
- fn find_map (( T) -> Option<U>) -> Option<U>
- fn position (( T) -> bool) -> Option<usize>
- fn rposition (( T) -> bool) -> Option<usize> where Self: ExactSizeIterator + DoubleEndedIterator
Boolean operations
Try iterating
- fn try_for_each ((T) -> R) -> R where R: Try<Ok = ()>
- fn try_fold (S, (S, T) -> R) -> R where R: Try<Ok = S>
iter
Creating simple iterators
- fn empty () -> Iterator<Item = T>
- fn once (T) -> Iterator<Item = T>
- fn once_with (() -> T) -> Iterator<Item = T>
- fn repeat (T) -> Iterator<Item = T> where T: Clone
- fn repeat_with (() -> T) -> Iterator<Item = T>
- fn from_fn (() -> Option<T>) -> Iterator<Item = T>
- fn successors (Option<T>, (&T) -> Option<T>) -> Iterator<Item = T>
&[T]
Splitting to iterator
- fn split ((&T) -> bool) -> Iterator<Item = &[T]>
- fn rsplit ((&T) -> bool) -> Iterator<Item = &[T]>
- fn splitn (usize, (&T) -> bool) -> Iterator<Item = &[T]>
- fn rsplitn (usize, (&T) -> bool) -> Iterator<Item = &[T]>
Splitting at position
- fn split_at (usize) -> (&[T], &[T])
- fn split_first () -> Option<(&T, &[T])>
- fn split_last () -> Option<(&T, &[T])>
Chunks and windows
- fn chunks (usize) -> Iterator<Item = &[T]>
- fn chunks_exact (usize) -> Iterator<Item = &[T]>
- fn rchunks (usize) -> Iterator<Item = &[T]>
- fn rchunks_exact (usize) -> Iterator<Item = &[T]>
- fn windows (usize) -> Iterator<Item = &[T]>
Matching
- fn contains (&T) -> bool where T: PartialEq
- fn starts_with (&[T]) -> bool where T: PartialEq
- fn ends_with (&[T]) -> bool where T: PartialEq
Binary searching
- fn binary_search (&T) -> Result<usize, usize> where T: Ord
- fn binary_search_by ((&T) -> Ordering) -> Result<usize, usize>
- fn binary_search_by_key (&B, (&T) -> B) -> Result<usize, usize> where B: Ord
Getting and iterating
- fn first () -> Option<&T>
- fn last () -> Option<&T>
- fn get (SliceIndex<[T]>) -> Option<&T>
- fn iter () -> Iterator<Item = &T>
Length
&mut [T]
Splitting to iterator
- fn split_mut ((&T) -> bool) -> Iterator<Item = &mut [T]>
- fn rsplit_mut ((&T) -> bool) -> Iterator<Item = &mut [T]>
- fn splitn_mut (usize, (&T) -> bool) -> Iterator<Item = &mut [T]>
- fn rsplitn_mut (usize, (&T) -> bool) -> Iterator<Item = &mut [T]>
Splitting at position
- fn split_at_mut (usize) -> (&mut [T], &mut [T])
- fn split_first_mut () -> Option<(&mut T, &mut [T])>
- fn split_last_mut () -> Option<(&mut T, &mut [T])>
Chunks
- fn chunks_mut (usize) -> Iterator<Item = &mut [T]>
- fn chunks_exact_mut (usize) -> Iterator<Item = &mut [T]>
- fn rchunks_mut (usize) -> Iterator<Item = &mut [T]>
- fn rchunks_exact_mut (usize) -> Iterator<Item = &mut [T]>
Sorting
- fn sort () where T: Ord
- fn sort_by ((&T, &T) -> Ordering)
- fn sort_by_key ((&T) -> K) where K: Ord
- fn sort_by_cached_key ((&T) -> K) where K: Ord
- fn sort_unstable () where T: Ord
- fn sort_unstable_by ((&T, &T) -> Ordering)
- fn sort_unstable_by_key ((&T) -> K) where K: Ord
Rearranging
- fn swap (usize, usize)
- fn reverse ()
- fn rotate_left (usize)
- fn rotate_right (usize)
Overriding
- fn swap_with_slice (&mut [T])
- fn copy_from_slice (&[T]) where T: Copy
- fn clone_from_slice (&[T]) where T: Clone
Getting and iterating
- fn first_mut () -> Option<&mut T>
- fn last_mut () -> Option<&mut T>
- fn get_mut (SliceIndex<[T]>) -> Option<&mut T>
- fn iter_mut () -> Iterator<Item = &mut T>
&mut Vec<T>
Adding and removing single item
- fn push (T)
- fn pop () -> Option<T>
- fn insert (usize, T)
- fn remove (usize) -> T
- fn swap_remove (usize) -> T
Extending
- fn append (&mut Vec<T>)
- fn extend (IntoIterator<Item = T>)
- fn extend (IntoIterator<Item = &T>) where T: Copy
- fn extend_from_slice (&[T]) where T: Clone
Resizing
Clearing
Removing or replacing range into iterator
- fn drain (RangeBounds<usize>) -> Iterator<T>
- fn splice (RangeBounds<usize>, IntoIterator<Item = T>) -> Iterator<T>
Deduplicating
- fn dedup () where T: PartialEq
- fn dedup_by ((&mut T, &mut T) -> bool)
- fn dedup_by_key ((&mut T) -> K) where K: PartialEq
Splitting off
Capacity manipulation
- fn reserve (usize)
- fn reserve_exact (usize)
- fn shrink_to_fit ()
slice
Creating slice from reference
&[u8]
ASCII
- fn is_ascii () -> bool
- fn eq_ignore_ascii_case (&[u8]) -> bool
- fn to_ascii_uppercase () -> Vec<u8>
- fn to_ascii_lowercase () -> Vec<u8>
&mut [u8]
ASCII
- fn make_ascii_uppercase ()
- fn make_ascii_lowercase ()
str
Bytes
- fn from_utf8 (&[u8]) -> Result<&str, Utf8Error>
- fn from_utf8_mut (&mut [u8]) -> Result<&mut str, Utf8Error>
&str
Chars
- fn chars () -> Iterator<Item = char>
- fn char_indices () -> Iterator<Item = (usize, char)>
- fn is_char_boundary (usize) -> bool
Bytes
Splitting to two parts
Splitting to iterator
- fn lines () -> Iterator<Item = &str>
- fn split_whitespace () -> Iterator<Item = &str>
- fn split_ascii_whitespace () -> Iterator<Item = &str>
- fn split (Pattern) -> Iterator<Item = &str>
- fn rsplit (Pattern) -> Iterator<Item = &str>
- fn splitn (usize, Pattern) -> Iterator<Item = &str>
- fn rsplitn (usize, Pattern) -> Iterator<Item = &str>
- fn split_terminator (Pattern) -> Iterator<Item = &str>
- fn rsplit_terminator (Pattern) -> Iterator<Item = &str>
Trimming
- fn trim () -> &str
- fn trim_start () -> &str
- fn trim_end () -> &str
- fn trim_matches (Pattern) -> &str
- fn trim_start_matches (Pattern) -> &str
- fn trim_end_matches (Pattern) -> &str
Matching and finding
- fn contains (Pattern) -> bool
- fn starts_with (Pattern) -> bool
- fn ends_with (Pattern) -> bool
- fn find (Pattern) -> Option<usize>
- fn rfind (Pattern) -> Option<usize>
- fn matches (Pattern) -> Iterator<Item = &str>
- fn rmatches (Pattern) -> Iterator<Item = &str>
- fn match_indices (Pattern) -> Iterator<Item = (usize, &str)>
- fn rmatch_indices (Pattern) -> Iterator<Item = (usize, &str)>
Case
- fn to_uppercase () -> String
- fn to_lowercase () -> String
- fn to_ascii_uppercase () -> String
- fn to_ascii_lowercase () -> String
- fn eq_ignore_ascii_case (&str) -> bool
Replacing
Length
Misc.
- fn is_ascii () -> bool
- fn repeat (usize) -> String
- fn encode_utf16 () -> Iterator<Item = u16>
- fn parse () -> Result<F, F::Err> where F: FromStr
&mut str
Splitting to two parts
Case conversion
- fn make_ascii_uppercase ()
- fn make_ascii_lowercase ()
&mut String
Inserting and appending string
Adding and removing char
Clearing
Capacity manipulation
- fn reserve (usize)
- fn reserve_exact (usize)
- fn shrink_to_fit ()