Iterator::any

Iterator::any 是一个函数,当传递一个迭代器时,如果任何元素满足谓词,它将返回 true。否则返回 false。它的签名是

pub trait Iterator { // The type being iterated over. type Item; // `any` takes `&mut self` meaning the caller may be borrowed // and modified, but not consumed. fn any<F>(&mut self, f: F) -> bool where // `FnMut` meaning any captured variable may at most be // modified, not consumed. `Self::Item` states it takes // arguments to the closure by value. F: FnMut(Self::Item) -> bool; }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

另请参阅

std::iter::Iterator::any