do-notation
do-notation copied to clipboard
optionally drop the move keyword?
In a block like:
fn update(&mut self) {
m! {
guard(self.grabbing);
let del = input_state.pointer.delta();
guard(del.x != 0.0 || del.y != 0.0);
x <- pointer_hover_frac(input_state);
Some(self.add_pos2(x))
};
// I want to use self here but it's gone
}
Perhaps p <= e could desugar to e.and_then(move |p| while p <- e could be changed to e.and_then(|p|? Ideally it would be possible to use the move keyword only when there is a semicolon, but at first glance it doesn't look like a macro can know about layout or indentation.