Структура RMatchIndices

#![allow(unused)]
fn main() {
pub struct RMatchIndices<'a, P>(/* приватные поля */)
where
    P: Pattern;
}

Создается методом rmatch_indices.

Реализации трейтов

impl<'a, P> Clone for RMatchIndices<'a, P>

#![allow(unused)]
fn main() {
where
    P: Pattern,
    <P as Pattern>::Searcher<'a>: Clone,
}
ФункцияСинтаксисПримерНазначение
clonefn clone(&self) -> RMatchIndices<'a, P> ⓘlet cloned = rmatch_indices.clone();Возвращает копию значения
clone_fromfn clone_from(&mut self, source: &Self)rmatch_indices.clone_from(&other);Выполняет копирующее присваивание из source

impl<'a, P> Debug for RMatchIndices<'a, P>

#![allow(unused)]
fn main() {
where
    P: Pattern,
    <P as Pattern>::Searcher<'a>: Debug,
}
ФункцияСинтаксисПримерНазначение
fmtfn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>println!("{:?}", rmatch_indices);Форматирует значение с помощью заданного форматтера

impl<'a, P> DoubleEndedIterator for RMatchIndices<'a, P>

#![allow(unused)]
fn main() {
where
    P: Pattern,
    <P as Pattern>::Searcher<'a>: DoubleEndedSearcher<'a>,
}
ФункцияСинтаксисПримерНазначение
next_backfn next_back(&mut self) -> Option<(usize, &'a str)>let last_match = rmatch_indices.next_back();Удаляет и возвращает элемент с конца итератора
advance_back_byfn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>rmatch_indices.advance_back_by(2)?;🔬 Перемещает итератор с конца на n элементов
nth_back (с версии 1.37.0)fn nth_back(&mut self, n: usize) -> Option<Self::Item>let second_last = rmatch_indices.nth_back(1);Возвращает n-й элемент с конца итератора
try_rfold (с версии 1.27.0)fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R`let result = rmatch_indices.try_rfold(vec![],mut v, (i, s)
rfold (с версии 1.27.0)fn rfold<B, F>(self, init: B, f: F) -> B`let total_len = rmatch_indices.rfold(0,acc, (_, s)
rfind (с версии 1.27.0)fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>`let last_long = rmatch_indices.rfind((_, s)

impl<'a, P> Iterator for RMatchIndices<'a, P>

#![allow(unused)]
fn main() {
where
    P: Pattern,
    <P as Pattern>::Searcher<'a>: ReverseSearcher<'a>,
}
ФункцияСинтаксисПримерНазначение
Itemtype Item = (usize, &'a str)-Тип элементов, по которым выполняется итерация
nextfn next(&mut self) -> Option<(usize, &'a str)>let next_match = rmatch_indices.next();Продвигает итератор и возвращает следующее значение
next_chunkfn next_chunk<const N: usize>(&mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>let chunk: [(usize, &str); 3] = rmatch_indices.next_chunk()?;🔬 Возвращает массив следующих N значений
size_hintfn size_hint(&self) -> (usize, Option<usize>)let (min, max) = rmatch_indices.size_hint();Возвращает границы оставшейся длины итератора
countfn count(self) -> usizelet total = rmatch_indices.count();Потребляет итератор, подсчитывая количество итераций
lastfn last(self) -> Option<Self::Item>let final_match = rmatch_indices.last();Потребляет итератор, возвращая последний элемент
advance_byfn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>rmatch_indices.advance_by(2)?;🔬 Продвигает итератор на n элементов
nthfn nth(&mut self, n: usize) -> Option<Self::Item>let third = rmatch_indices.nth(2);Возвращает n-й элемент итератора
step_by (с версии 1.28.0)fn step_by(self, step: usize) -> StepBy<Self> ⓘlet stepped = rmatch_indices.step_by(2);Создает итератор с заданным шагом
chainfn chain<U>(self, other: U) -> Chain<Self, U::IntoIter> ⓘlet combined = rmatch_indices.chain(other_indices);Объединяет два итератора в последовательности
zipfn zip<U>(self, other: U) -> Zip<Self, U::IntoIter> ⓘlet zipped = rmatch_indices.zip(other_indices);Объединяет два итератора в итератор пар
interspersefn intersperse(self, separator: Self::Item) -> Intersperse<Self> ⓘlet with_sep = rmatch_indices.intersperse((0, ""));🔬 Разделяет элементы разделителем
intersperse_withfn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G> ⓘ`let with_sep = rmatch_indices.intersperse_with(
mapfn map<B, F>(self, f: F) -> Map<Self, F> ⓘ`let indices_only = rmatch_indices.map((i, _)
for_each (с версии 1.21.0)fn for_each<F>(self, f: F)`rmatch_indices.for_each((i, s)
filterfn filter<P>(self, predicate: P) -> Filter<Self, P> ⓘ`let long = rmatch_indices.filter((_, s)
filter_mapfn filter_map<B, F>(self, f: F) -> FilterMap<Self, F> ⓘ`let lengths = rmatch_indices.filter_map((i, s)
enumeratefn enumerate(self) -> Enumerate<Self> ⓘfor (iter_idx, (pos, s)) in rmatch_indices.enumerate()Добавляет индекс итерации к каждому элементу
peekablefn peekable(self) -> Peekable<Self> ⓘlet peekable = rmatch_indices.peekable();Создает итератор с возможностью заглядывания вперед
skip_whilefn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> ⓘ`let skipped = rmatch_indices.skip_while((_, s)
take_whilefn take_while<P>(self, predicate: P) -> TakeWhile<Self, P> ⓘ`let taken = rmatch_indices.take_while((_, s)
map_while (с версии 1.57.0)fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P> ⓘ`let indices = rmatch_indices.map_while((i, s)
skipfn skip(self, n: usize) -> Skip<Self> ⓘlet skipped = rmatch_indices.skip(2);Пропускает первые n элементов
takefn take(self, n: usize) -> Take<Self> ⓘlet first_3 = rmatch_indices.take(3);Берет первые n элементов
scanfn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F> ⓘ`let positions = rmatch_indices.scan(vec![],v, (i, _)
flat_mapfn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F> ⓘ`let chars = rmatch_indices.flat_map((_, s)
flatten (с версии 1.29.0)fn flatten(self) -> Flatten<Self> ⓘlet flattened = rmatch_indices.flatten();Разворачивает вложенные структуры
map_windowsfn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N> ⓘ`let windows = rmatch_indices.map_windows(arr: &[(usize, &str); 3]
fusefn fuse(self) -> Fuse<Self> ⓘlet fused = rmatch_indices.fuse();Создает итератор, завершающийся после первого None
inspectfn inspect<F>(self, f: F) -> Inspect<Self, F> ⓘ`let inspected = rmatch_indices.inspect((i, s)
by_reffn by_ref(&mut self) -> &mut Selffor (i, s) in rmatch_indices.by_ref().take(2)Создает ссылку на итератор
collectfn collect<B>(self) -> Blet vec: Vec<(usize, &str)> = rmatch_indices.collect();Преобразует итератор в коллекцию
try_collectfn try_collect<B>(&mut self) -> ...let vec: Vec<Result<(usize, &str), _>> = rmatch_indices.try_collect();🔬 Преобразует итератор с обработкой ошибок
collect_intofn collect_into<E>(self, collection: &mut E) -> &mut Ermatch_indices.collect_into(&mut vec);🔬 Собирает элементы в существующую коллекцию
partitionfn partition<B, F>(self, f: F) -> (B, B)`let (long, short): (Vec<>, Vec<>) = rmatch_indices.partition((_, s)
partition_in_placefn partition_in_place<'a, T, P>(self, predicate: P) -> usize`let true_count = rmatch_indices.partition_in_place((_, s)
is_partitionedfn is_partitioned<P>(self, predicate: P) -> bool`let partitioned = rmatch_indices.is_partitioned((_, s)
try_fold (с версии 1.27.0)fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R`let sum = rmatch_indices.try_fold(0,acc, (_, s)
try_for_each (с версии 1.27.0)fn try_for_each<F, R>(&mut self, f: F) -> R`rmatch_indices.try_for_each((i, s)
foldfn fold<B, F>(self, init: B, f: F) -> B`let total_len = rmatch_indices.fold(0,acc, (_, s)
reduce (с версии 1.51.0)fn reduce<F>(self, f: F) -> Option<Self::Item>`let longest = rmatch_indices.reduce(a, b
try_reducefn try_reduce<R>(&mut self, f: impl FnMut(Self::Item, Self::Item) -> R) -> ...`let longest = rmatch_indices.try_reduce(a, b
allfn all<F>(&mut self, f: F) -> bool`let all_long = rmatch_indices.all((_, s)
anyfn any<F>(&mut self, f: F) -> bool`let any_long = rmatch_indices.any((_, s)
findfn find<P>(&mut self, predicate: P) -> Option<Self::Item>`let long = rmatch_indices.find((_, s)
find_map (с версии 1.30.0)fn find_map<B, F>(&mut self, f: F) -> Option<B>`let pos = rmatch_indices.find_map((i, s)
try_findfn try_find<R>(&mut self, f: impl FnMut(&Self::Item) -> R) -> ...`let long = rmatch_indices.try_find((_, s)
positionfn position<P>(&mut self, predicate: P) -> Option<usize>`let pos = rmatch_indices.position((_, s)
rpositionfn rposition<P>(&mut self, predicate: P) -> Option<usize>`let rpos = rmatch_indices.rposition((_, s)
maxfn max(self) -> Option<Self::Item>let longest = rmatch_indices.max();Возвращает максимальный элемент
minfn min(self) -> Option<Self::Item>let shortest = rmatch_indices.min();Возвращает минимальный элемент
max_by_key (с версии 1.6.0)fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>`let longest = rmatch_indices.max_by_key((_, s)
max_by (с версии 1.15.0)fn max_by<F>(self, compare: F) -> Option<Self::Item>`let longest = rmatch_indices.max_by(a, b
min_by_key (с версии 1.6.0)fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>`let shortest = rmatch_indices.min_by_key((_, s)
min_by (с версии 1.15.0)fn min_by<F>(self, compare: F) -> Option<Self::Item>`let shortest = rmatch_indices.min_by(a, b
revfn rev(self) -> Rev<Self> ⓘlet reversed = rmatch_indices.rev();Обращает направление итератора
unzipfn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)let (indices, strings): (Vec<usize>, Vec<&str>) = rmatch_indices.unzip();Разделяет пары на две коллекции
copied (с версии 1.36.0)fn copied<'a, T>(self) -> Copied<Self> ⓘlet copied: Copied<_> = rmatch_indices.copied();Создает итератор, копирующий элементы
clonedfn cloned<'a, T>(self) -> Cloned<Self> ⓘlet cloned: Cloned<_> = rmatch_indices.cloned();Создает итератор, клонирующий элементы
cyclefn cycle(self) -> Cycle<Self> ⓘlet cycled = rmatch_indices.cycle();Бесконечно повторяет итератор
array_chunksfn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N> ⓘlet chunks = rmatch_indices.array_chunks::<3>();🔬 Возвращает элементы массивами по N штук
sum (с версии 1.11.0)fn sum<S>(self) -> S`let total_len: usize = rmatch_indices.map((_, s)
product (с версии 1.11.0)fn product<P>(self) -> P`let product: i32 = rmatch_indices.map((_, s)
cmp (с версии 1.5.0)fn cmp<I>(self, other: I) -> Orderinglet ordering = rmatch_indices.cmp(other_indices);Лексикографически сравнивает с другим итератором
cmp_byfn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering`let ordering = rmatch_indices.cmp_by(other_indices,a, b
partial_cmp (с версии 1.5.0)fn partial_cmp<I>(self, other: I) -> Option<Ordering>let ordering = rmatch_indices.partial_cmp(other_indices);Частично сравнивает с другим итератором
partial_cmp_byfn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>`let ordering = rmatch_indices.partial_cmp_by(other_indices,a, b
eq (с версии 1.5.0)fn eq<I>(self, other: I) -> boollet equal = rmatch_indices.eq(other_indices);Проверяет равенство элементов
eq_byfn eq_by<I, F>(self, other: I, eq: F) -> bool`let equal = rmatch_indices.eq_by(other_indices,a, b
ne (с версии 1.5.0)fn ne<I>(self, other: I) -> boollet not_equal = rmatch_indices.ne(other_indices);Проверяет неравенство элементов
lt (с версии 1.5.0)fn lt<I>(self, other: I) -> boollet less = rmatch_indices.lt(other_indices);Проверяет, меньше ли элементы
le (с версии 1.5.0)fn le<I>(self, other: I) -> boollet less_equal = rmatch_indices.le(other_indices);Проверяет, меньше или равны ли элементы
gt (с версии 1.5.0)fn gt<I>(self, other: I) -> boollet greater = rmatch_indices.gt(other_indices);Проверяет, больше ли элементы
ge (с версии 1.5.0)fn ge<I>(self, other: I) -> boollet greater_equal = rmatch_indices.ge(other_indices);Проверяет, больше или равны ли элементы
is_sorted (с версии 1.82.0)fn is_sorted(self) -> boollet sorted = rmatch_indices.is_sorted();Проверяет, отсортированы ли элементы
is_sorted_by (с версии 1.82.0)fn is_sorted_by<F>(self, compare: F) -> bool`let sorted = rmatch_indices.is_sorted_by(a, b
is_sorted_by_key (с версии 1.82.0)fn is_sorted_by_key<F, K>(self, f: F) -> bool`let sorted = rmatch_indices.is_sorted_by_key((_, s)

impl<'a, P> FusedIterator for RMatchIndices<'a, P>

#![allow(unused)]
fn main() {
where
    P: Pattern,
    <P as Pattern>::Searcher<'a>: ReverseSearcher<'a>,
}
ФункцияСинтаксисПримерНазначение
(Этот трейт не добавляет новых методов, а только гарантирует, что после первого None все последующие вызовы next() также будут возвращать None. Это свойство наследуется от итератора.)

Автоматические реализации трейтов

ТрейтУсловия реализации
FreezeЕсли Pattern::Searcher<'a>: Freeze
RefUnwindSafeЕсли Pattern::Searcher<'a>: RefUnwindSafe
SendЕсли Pattern::Searcher<'a>: Send
SyncЕсли Pattern::Searcher<'a>: Sync
UnpinЕсли Pattern::Searcher<'a>: Unpin
UnwindSafeЕсли Pattern::Searcher<'a>: UnwindSafe