This syntax focus on being simple and recognizable rust code, with the possibility to incrementally extend the capabilities that keyewords generic may provide.
#![allow(unused)]fnmain() {
/// A trimmed-down version of the `std::Iterator` trait.pubtraitIterator {
typeItem;
fnnext(&mutself) -> Option<Self::Item>;
fnsize_hint(&self) -> (usize, Option<usize>);
}
/// An adaptation of `Iterator::find` to a free-functionpubfnfind<I, T, P>(iter: &mut I, predicate: P) -> Option<T>
where
I: Iterator<Item = T> + Sized,
P: FnMut(&T) -> bool;
}
The syntax does not give shortans for specifying all modifiers at once. Instead, the function, trait or type should explicit bound over all keywords it could be generic.
Although being inconvenient to list it manually, this has some advantages over the generic over all keywords available syntax.
Allowing the generic over all means that in case a new keyword lands, all complete generic functions and traits may be affected by the keyword, requiring at least some considerations on the side effects.