icu4x icon indicating copy to clipboard operation
icu4x copied to clipboard

Add return type to `Yoke::with_mut` and `Yokeable::transform_mut`

Open jdygert-spok opened this issue 6 months ago • 6 comments

I believe this is still sound since R can't involve 'b.

fn with_mut<'a, F, R>(&'a mut self, f: F) -> R
where
    F: 'static + for<'b> FnOnce(&'b mut <Y as Yokeable<'a>>::Output) -> R;

fn transform_mut<F, R>(&'a mut self, f: F) -> R
where
    F: 'static + for<'b> FnOnce(&'b mut Self::Output) -> R;

This would be a breaking change, mainly for anyone manually implementing Yokeable.

Notably, this lets us easily call Iterator::next on an iter in a yoke, or even implement Iterator for Yoke.

jdygert-spok avatar Aug 14 '24 22:08 jdygert-spok