Design

base (reference)

#![allow(unused)] fn main() { /// A trimmed-down version of the `std::Iterator` trait. pub trait async? Iterator { type Item; async? fn next(&mut self) -> Option<Self::Item>; fn size_hint(&self) -> (usize, Option<usize>); } /// An adaptation of `Iterator::find` to a free-function pub async? fn find<I, T, P>(iter: &mut I, predicate: P) -> Option<T> where I: async? Iterator<Item = T> + Sized, P: FnMut(&T) -> bool; }

always async

#![allow(unused)] fn main() { /// An adaptation of `Iterator::find` to a free-function pub async fn find<I, T, P>(iter: &mut I, predicate: P) -> Option<T> where I: async Iterator<Item = T> + Sized, P: FnMut(&T) -> bool; }

maybe async

#![allow(unused)] fn main() { pub async? fn find<I, T, P>(iter: &mut I, predicate: P) -> Option<T> where I: async? Iterator<Item = T> + Sized, P: FnMut(&T) -> bool; }

generic over all modifier keywords

#![allow(unused)] fn main() { /// A trimmed-down version of the `std::Iterator` trait. pub trait effect Iterator { type Item; effect fn next(&mut self) -> Option<Self::Item>; fn size_hint(&self) -> (usize, Option<usize>); } }

Notes

This is just a postfix version of the originally proposed syntax. This should appear more familiar, as the question mark is normally used at the end of a sentence, not at the beginning, and it looks similar to typescripts nullable types. it also makes generic references more legible &mut? T vs &?mut T.