iterator

iterator

iterator trait主要是为了for循环使用而设计。
for循环默认使用into_iter()

into_iter, iter and iter_mut

  1. iter: borrow each element
  2. into_iter: cousumes the collection
  3. iter_mut: mutably borrows each element of the collection
,
© 2023 PLAYAROUND All Rights Reserved. 本站访客数人次 本站总访问量
Theme by hiero