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.
// `any`は`&mut self`を取るため、イテレータを呼び出した値を借用し
// 変更しますが、消費し尽くすことはありません。
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.
// `FnMut`はクロージャによって捕捉される変数が変更される
// 事はあっても消費されることはないということを示します。
// `Self::Item`はクロージャが変数を値として取ることを示します。
F: FnMut(Self::Item) -> bool;
}