- Name:
postfix-question-mark - Proposed by: @tvallotton
/// 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;/// 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;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;/// 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>);
}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.