pub struct IntoIter<T> { /* private fields */ }
Expand description
Trait Implementations§
source§impl<T> DoubleEndedIterator for IntoIter<T>
impl<T> DoubleEndedIterator for IntoIter<T>
source§fn advance_back_by(&mut self, n: usize) -> Result<(), NonZeroUsize>
fn advance_back_by(&mut self, n: usize) -> Result<(), NonZeroUsize>
🔬This is a nightly-only experimental API. (
iter_advance_by
#77404)通过
n
元素从后向前推进迭代器。 Read more1.27.0 · source§fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere
Self: Sized,
F: FnMut(B, Self::Item) -> R,
R: Try<Output = B>,
fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> Rwhere Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try<Output = B>,
这是
Iterator::try_fold()
的反向版本:它从迭代器的后面开始接收元素。 Read moresource§impl<T> ExactSizeIterator for IntoIter<T>
impl<T> ExactSizeIterator for IntoIter<T>
source§impl<T> Iterator for IntoIter<T>
impl<T> Iterator for IntoIter<T>
source§fn next_chunk<const N: usize>(
&mut self
) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where
Self: Sized,
fn next_chunk<const N: usize>( &mut self ) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where Self: Sized,
🔬This is a nightly-only experimental API. (
iter_next_chunk
#98326)推进迭代器并返回包含下一个
N
值的数组。 Read moresource§fn advance_by(&mut self, n: usize) -> Result<(), NonZeroUsize>
fn advance_by(&mut self, n: usize) -> Result<(), NonZeroUsize>
🔬This is a nightly-only experimental API. (
iter_advance_by
#77404)通过
n
元素使迭代器前进。 Read more1.28.0 · source§fn step_by(self, step: usize) -> StepBy<Self> ⓘwhere
Self: Sized,
fn step_by(self, step: usize) -> StepBy<Self> ⓘwhere Self: Sized,
创建一个从同一点开始的迭代器,但在每次迭代时以给定的数量逐步执行。 Read more
source§fn chain<U>(self, other: U) -> Chain<Self, U::IntoIter> ⓘwhere
Self: Sized,
U: IntoIterator<Item = Self::Item>,
fn chain<U>(self, other: U) -> Chain<Self, U::IntoIter> ⓘwhere Self: Sized, U: IntoIterator<Item = Self::Item>,
接受两个迭代器,并依次在两个迭代器上创建一个新的迭代器。 Read more
source§fn zip<U>(self, other: U) -> Zip<Self, U::IntoIter> ⓘwhere
Self: Sized,
U: IntoIterator,
fn zip<U>(self, other: U) -> Zip<Self, U::IntoIter> ⓘwhere Self: Sized, U: IntoIterator,
将两个迭代器压缩为成对的单个迭代器。 Read more
source§fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G> ⓘwhere
Self: Sized,
G: FnMut() -> Self::Item,
fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G> ⓘwhere Self: Sized, G: FnMut() -> Self::Item,
🔬This is a nightly-only experimental API. (
iter_intersperse
#79524)创建一个新的迭代器,该迭代器将
separator
生成的项放在原始迭代器的相邻项之间。 Read moresource§fn map<B, F>(self, f: F) -> Map<Self, F> ⓘwhere
Self: Sized,
F: FnMut(Self::Item) -> B,
fn map<B, F>(self, f: F) -> Map<Self, F> ⓘwhere Self: Sized, F: FnMut(Self::Item) -> B,
获取一个闭包并创建一个迭代器,该迭代器在每个元素上调用该闭包。 Read more
1.21.0 · source§fn for_each<F>(self, f: F)where
Self: Sized,
F: FnMut(Self::Item),
fn for_each<F>(self, f: F)where Self: Sized, F: FnMut(Self::Item),
在迭代器的每个元素上调用一个闭包。 Read more
source§fn filter<P>(self, predicate: P) -> Filter<Self, P> ⓘwhere
Self: Sized,
P: FnMut(&Self::Item) -> bool,
fn filter<P>(self, predicate: P) -> Filter<Self, P> ⓘwhere Self: Sized, P: FnMut(&Self::Item) -> bool,
创建一个迭代器,该迭代器使用闭包确定是否应产生元素。 Read more
source§fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F> ⓘwhere
Self: Sized,
F: FnMut(Self::Item) -> Option<B>,
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F> ⓘwhere Self: Sized, F: FnMut(Self::Item) -> Option<B>,
创建一个同时过滤和映射的迭代器。 Read more
source§fn enumerate(self) -> Enumerate<Self> ⓘwhere
Self: Sized,
fn enumerate(self) -> Enumerate<Self> ⓘwhere Self: Sized,
创建一个迭代器,该迭代器给出当前迭代次数以及下一个值。 Read more
source§fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> ⓘwhere
Self: Sized,
P: FnMut(&Self::Item) -> bool,
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> ⓘwhere Self: Sized, P: FnMut(&Self::Item) -> bool,
source§fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P> ⓘwhere
Self: Sized,
P: FnMut(&Self::Item) -> bool,
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P> ⓘwhere Self: Sized, P: FnMut(&Self::Item) -> bool,
创建一个迭代器,该迭代器根据谓词产生元素。 Read more
1.57.0 · source§fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P> ⓘwhere
Self: Sized,
P: FnMut(Self::Item) -> Option<B>,
fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P> ⓘwhere Self: Sized, P: FnMut(Self::Item) -> Option<B>,
创建一个迭代器,该迭代器均基于谓词和映射生成元素。 Read more
source§fn take(self, n: usize) -> Take<Self> ⓘwhere
Self: Sized,
fn take(self, n: usize) -> Take<Self> ⓘwhere Self: Sized,
创建一个迭代器,它产生第一个
n
元素,如果底层迭代器提前结束,则产生更少的元素。 Read moresource§fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F> ⓘwhere
Self: Sized,
F: FnMut(&mut St, Self::Item) -> Option<B>,
fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F> ⓘwhere Self: Sized, F: FnMut(&mut St, Self::Item) -> Option<B>,
source§fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F> ⓘwhere
Self: Sized,
U: IntoIterator,
F: FnMut(Self::Item) -> U,
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F> ⓘwhere Self: Sized, U: IntoIterator, F: FnMut(Self::Item) -> U,
创建一个迭代器,其工作方式类似于 map,但它会将嵌套的结构展平。 Read more
source§fn inspect<F>(self, f: F) -> Inspect<Self, F> ⓘwhere
Self: Sized,
F: FnMut(&Self::Item),
fn inspect<F>(self, f: F) -> Inspect<Self, F> ⓘwhere Self: Sized, F: FnMut(&Self::Item),
对迭代器的每个元素执行某些操作,将值传递给它。 Read more
source§fn collect_into<E: Extend<Self::Item>>(self, collection: &mut E) -> &mut Ewhere
Self: Sized,
fn collect_into<E: Extend<Self::Item>>(self, collection: &mut E) -> &mut Ewhere Self: Sized,
🔬This is a nightly-only experimental API. (
iter_collect_into
#94780)将迭代器中的所有项收集到一个集合中。 Read more
source§fn partition<B, F>(self, f: F) -> (B, B)where
Self: Sized,
B: Default + Extend<Self::Item>,
F: FnMut(&Self::Item) -> bool,
fn partition<B, F>(self, f: F) -> (B, B)where Self: Sized, B: Default + Extend<Self::Item>, F: FnMut(&Self::Item) -> bool,
消耗一个迭代器,从中创建两个集合。 Read more
source§fn partition_in_place<'a, T: 'a, P>(self, predicate: P) -> usizewhere
Self: Sized + DoubleEndedIterator<Item = &'a mut T>,
P: FnMut(&T) -> bool,
fn partition_in_place<'a, T: 'a, P>(self, predicate: P) -> usizewhere Self: Sized + DoubleEndedIterator<Item = &'a mut T>, P: FnMut(&T) -> bool,
🔬This is a nightly-only experimental API. (
iter_partition_in_place
#62543)source§fn is_partitioned<P>(self, predicate: P) -> boolwhere
Self: Sized,
P: FnMut(Self::Item) -> bool,
fn is_partitioned<P>(self, predicate: P) -> boolwhere Self: Sized, P: FnMut(Self::Item) -> bool,
🔬This is a nightly-only experimental API. (
iter_is_partitioned
#62544)1.27.0 · source§fn try_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere
Self: Sized,
F: FnMut(B, Self::Item) -> R,
R: Try<Output = B>,
fn try_fold<B, F, R>(&mut self, init: B, f: F) -> Rwhere Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try<Output = B>,
一个迭代器方法,它只要成功返回就应用函数,并产生单个最终值。 Read more
1.27.0 · source§fn try_for_each<F, R>(&mut self, f: F) -> Rwhere
Self: Sized,
F: FnMut(Self::Item) -> R,
R: Try<Output = ()>,
fn try_for_each<F, R>(&mut self, f: F) -> Rwhere Self: Sized, F: FnMut(Self::Item) -> R, R: Try<Output = ()>,
一个迭代器方法,该方法将一个容易犯错的函数应用于迭代器中的每个项,在第一个错误处停止并返回该错误。 Read more
source§fn fold<B, F>(self, init: B, f: F) -> Bwhere
Self: Sized,
F: FnMut(B, Self::Item) -> B,
fn fold<B, F>(self, init: B, f: F) -> Bwhere Self: Sized, F: FnMut(B, Self::Item) -> B,
通过应用操作将每个元素
fold
到一个累加器中,返回最终结果。 Read more1.51.0 · source§fn reduce<F>(self, f: F) -> Option<Self::Item>where
Self: Sized,
F: FnMut(Self::Item, Self::Item) -> Self::Item,
fn reduce<F>(self, f: F) -> Option<Self::Item>where Self: Sized, F: FnMut(Self::Item, Self::Item) -> Self::Item,
通过重复应用缩减操作,将元素缩减为一个。 Read more
source§fn try_reduce<F, R>(
&mut self,
f: F
) -> <<R as Try>::Residual as Residual<Option<R::Output>>>::TryTypewhere
Self: Sized,
F: FnMut(Self::Item, Self::Item) -> R,
R: Try<Output = Self::Item>,
R::Residual: Residual<Option<Self::Item>>,
fn try_reduce<F, R>( &mut self, f: F ) -> <<R as Try>::Residual as Residual<Option<R::Output>>>::TryTypewhere Self: Sized, F: FnMut(Self::Item, Self::Item) -> R, R: Try<Output = Self::Item>, R::Residual: Residual<Option<Self::Item>>,
🔬This is a nightly-only experimental API. (
iterator_try_reduce
#87053)通过重复应用 Reduce 操作,将元素归约为单个元素。
如果闭包返回失败,则失败会立即传播给调用者。 Read more
source§fn all<F>(&mut self, f: F) -> boolwhere
Self: Sized,
F: FnMut(Self::Item) -> bool,
fn all<F>(&mut self, f: F) -> boolwhere Self: Sized, F: FnMut(Self::Item) -> bool,
测试迭代器的每个元素是否与谓词匹配。 Read more
source§fn any<F>(&mut self, f: F) -> boolwhere
Self: Sized,
F: FnMut(Self::Item) -> bool,
fn any<F>(&mut self, f: F) -> boolwhere Self: Sized, F: FnMut(Self::Item) -> bool,
测试迭代器的任何元素是否与谓词匹配。 Read more
source§fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where
Self: Sized,
P: FnMut(&Self::Item) -> bool,
fn find<P>(&mut self, predicate: P) -> Option<Self::Item>where Self: Sized, P: FnMut(&Self::Item) -> bool,
搜索满足谓词的迭代器的元素。 Read more
1.30.0 · source§fn find_map<B, F>(&mut self, f: F) -> Option<B>where
Self: Sized,
F: FnMut(Self::Item) -> Option<B>,
fn find_map<B, F>(&mut self, f: F) -> Option<B>where Self: Sized, F: FnMut(Self::Item) -> Option<B>,
将函数应用于迭代器的元素,并返回第一个非 None 的结果。 Read more
source§fn try_find<F, R>(
&mut self,
f: F
) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere
Self: Sized,
F: FnMut(&Self::Item) -> R,
R: Try<Output = bool>,
R::Residual: Residual<Option<Self::Item>>,
fn try_find<F, R>( &mut self, f: F ) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere Self: Sized, F: FnMut(&Self::Item) -> R, R: Try<Output = bool>, R::Residual: Residual<Option<Self::Item>>,
🔬This is a nightly-only experimental API. (
try_find
#63178)将函数应用于迭代器的元素,并返回第一个为 true 的结果或第一个错误。 Read more
source§fn position<P>(&mut self, predicate: P) -> Option<usize>where
Self: Sized,
P: FnMut(Self::Item) -> bool,
fn position<P>(&mut self, predicate: P) -> Option<usize>where Self: Sized, P: FnMut(Self::Item) -> bool,
在迭代器中搜索元素,并返回其索引。 Read more
source§fn rposition<P>(&mut self, predicate: P) -> Option<usize>where
P: FnMut(Self::Item) -> bool,
Self: Sized + ExactSizeIterator + DoubleEndedIterator,
fn rposition<P>(&mut self, predicate: P) -> Option<usize>where P: FnMut(Self::Item) -> bool, Self: Sized + ExactSizeIterator + DoubleEndedIterator,
从右侧搜索迭代器中的元素,并返回其索引。 Read more
1.6.0 · source§fn max_by_key<B: Ord, F>(self, f: F) -> Option<Self::Item>where
Self: Sized,
F: FnMut(&Self::Item) -> B,
fn max_by_key<B: Ord, F>(self, f: F) -> Option<Self::Item>where Self: Sized, F: FnMut(&Self::Item) -> B,
返回给出指定函数最大值的元素。 Read more
1.15.0 · source§fn max_by<F>(self, compare: F) -> Option<Self::Item>where
Self: Sized,
F: FnMut(&Self::Item, &Self::Item) -> Ordering,
fn max_by<F>(self, compare: F) -> Option<Self::Item>where Self: Sized, F: FnMut(&Self::Item, &Self::Item) -> Ordering,
返回给出相对于指定比较函数的最大值的元素。 Read more
1.6.0 · source§fn min_by_key<B: Ord, F>(self, f: F) -> Option<Self::Item>where
Self: Sized,
F: FnMut(&Self::Item) -> B,
fn min_by_key<B: Ord, F>(self, f: F) -> Option<Self::Item>where Self: Sized, F: FnMut(&Self::Item) -> B,
返回给出指定函数中最小值的元素。 Read more
1.15.0 · source§fn min_by<F>(self, compare: F) -> Option<Self::Item>where
Self: Sized,
F: FnMut(&Self::Item, &Self::Item) -> Ordering,
fn min_by<F>(self, compare: F) -> Option<Self::Item>where Self: Sized, F: FnMut(&Self::Item, &Self::Item) -> Ordering,
返回给出相对于指定比较函数的最小值的元素。 Read more
source§fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where
FromA: Default + Extend<A>,
FromB: Default + Extend<B>,
Self: Sized + Iterator<Item = (A, B)>,
fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where FromA: Default + Extend<A>, FromB: Default + Extend<B>, Self: Sized + Iterator<Item = (A, B)>,
将成对的迭代器转换为一对容器。 Read more
1.36.0 · source§fn copied<'a, T>(self) -> Copied<Self> ⓘwhere
Self: Sized + Iterator<Item = &'a T>,
T: Copy + 'a,
fn copied<'a, T>(self) -> Copied<Self> ⓘwhere Self: Sized + Iterator<Item = &'a T>, T: Copy + 'a,
创建一个迭代器,该迭代器将复制其所有元素。 Read more
source§fn cloned<'a, T>(self) -> Cloned<Self> ⓘwhere
Self: Sized + Iterator<Item = &'a T>,
T: Clone + 'a,
fn cloned<'a, T>(self) -> Cloned<Self> ⓘwhere Self: Sized + Iterator<Item = &'a T>, T: Clone + 'a,
创建一个迭代器,该迭代器将克隆所有元素。 Read more
source§fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N> ⓘwhere
Self: Sized,
fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N> ⓘwhere Self: Sized,
🔬This is a nightly-only experimental API. (
iter_array_chunks
#100450)一次返回迭代器的
N
个元素的迭代器。 Read more1.11.0 · source§fn product<P>(self) -> Pwhere
Self: Sized,
P: Product<Self::Item>,
fn product<P>(self) -> Pwhere Self: Sized, P: Product<Self::Item>,
遍历整个迭代器,将所有元素相乘 Read more
source§fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere
Self: Sized,
I: IntoIterator,
F: FnMut(Self::Item, I::Item) -> Ordering,
fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere Self: Sized, I: IntoIterator, F: FnMut(Self::Item, I::Item) -> Ordering,
🔬This is a nightly-only experimental API. (
iter_order_by
#64295)1.5.0 · source§fn partial_cmp<I>(self, other: I) -> Option<Ordering>where
I: IntoIterator,
Self::Item: PartialOrd<I::Item>,
Self: Sized,
fn partial_cmp<I>(self, other: I) -> Option<Ordering>where I: IntoIterator, Self::Item: PartialOrd<I::Item>, Self: Sized,
Lexicographically 将此
Iterator
的 PartialOrd
元素与另一个 PartialOrd
的元素进行比较。
比较的工作方式类似于短路评估,返回结果而不比较其余元素。
一旦可以确定订单,评估就会停止并返回结果。 Read moresource§fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where
Self: Sized,
I: IntoIterator,
F: FnMut(Self::Item, I::Item) -> Option<Ordering>,
fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where Self: Sized, I: IntoIterator, F: FnMut(Self::Item, I::Item) -> Option<Ordering>,
🔬This is a nightly-only experimental API. (
iter_order_by
#64295)1.5.0 · source§fn eq<I>(self, other: I) -> boolwhere
I: IntoIterator,
Self::Item: PartialEq<I::Item>,
Self: Sized,
fn eq<I>(self, other: I) -> boolwhere I: IntoIterator, Self::Item: PartialEq<I::Item>, Self: Sized,
source§fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere
Self: Sized,
I: IntoIterator,
F: FnMut(Self::Item, I::Item) -> bool,
fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere Self: Sized, I: IntoIterator, F: FnMut(Self::Item, I::Item) -> bool,
🔬This is a nightly-only experimental API. (
iter_order_by
#64295)1.5.0 · source§fn ne<I>(self, other: I) -> boolwhere
I: IntoIterator,
Self::Item: PartialEq<I::Item>,
Self: Sized,
fn ne<I>(self, other: I) -> boolwhere I: IntoIterator, Self::Item: PartialEq<I::Item>, Self: Sized,
1.5.0 · source§fn lt<I>(self, other: I) -> boolwhere
I: IntoIterator,
Self::Item: PartialOrd<I::Item>,
Self: Sized,
fn lt<I>(self, other: I) -> boolwhere I: IntoIterator, Self::Item: PartialOrd<I::Item>, Self: Sized,
1.5.0 · source§fn le<I>(self, other: I) -> boolwhere
I: IntoIterator,
Self::Item: PartialOrd<I::Item>,
Self: Sized,
fn le<I>(self, other: I) -> boolwhere I: IntoIterator, Self::Item: PartialOrd<I::Item>, Self: Sized,
1.5.0 · source§fn gt<I>(self, other: I) -> boolwhere
I: IntoIterator,
Self::Item: PartialOrd<I::Item>,
Self: Sized,
fn gt<I>(self, other: I) -> boolwhere I: IntoIterator, Self::Item: PartialOrd<I::Item>, Self: Sized,
1.5.0 · source§fn ge<I>(self, other: I) -> boolwhere
I: IntoIterator,
Self::Item: PartialOrd<I::Item>,
Self: Sized,
fn ge<I>(self, other: I) -> boolwhere I: IntoIterator, Self::Item: PartialOrd<I::Item>, Self: Sized,
source§fn is_sorted_by<F>(self, compare: F) -> boolwhere
Self: Sized,
F: FnMut(&Self::Item, &Self::Item) -> Option<Ordering>,
fn is_sorted_by<F>(self, compare: F) -> boolwhere Self: Sized, F: FnMut(&Self::Item, &Self::Item) -> Option<Ordering>,
🔬This is a nightly-only experimental API. (
is_sorted
#53485)检查此迭代器的元素是否使用给定的比较器函数进行排序。 Read more
source§fn is_sorted_by_key<F, K>(self, f: F) -> boolwhere
Self: Sized,
F: FnMut(Self::Item) -> K,
K: PartialOrd,
fn is_sorted_by_key<F, K>(self, f: F) -> boolwhere Self: Sized, F: FnMut(Self::Item) -> K, K: PartialOrd,
🔬This is a nightly-only experimental API. (
is_sorted
#53485)检查此迭代器的元素是否使用给定的键提取函数进行排序。 Read more
impl<T> FusedIterator for IntoIter<T>
impl<A> TrustedLen for IntoIter<A>
Auto Trait Implementations§
impl<T> RefUnwindSafe for IntoIter<T>where T: RefUnwindSafe,
impl<T> Send for IntoIter<T>where T: Send,
impl<T> Sync for IntoIter<T>where T: Sync,
impl<T> Unpin for IntoIter<T>where T: Unpin,
impl<T> UnwindSafe for IntoIter<T>where T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
从拥有的值中借用。 Read more