iced-rs / iced

A cross-platform GUI library for Rust, inspired by Elm
https://iced.rs
MIT License
26.33k stars 1.28k forks source link

Relax Task::perform from Fn to more general FnOnce #2827

Closed ryco117 closed 1 month ago

ryco117 commented 1 month ago

FutureExt::map only requires the more generic FnOnce trait (a function capable of being called once) whereas perform currently requires a function capable of being called arbitrarily many times. Should be safe: Since both Fn and FnMut are subtraits of FnOnce, any instance of Fn or FnMut can be used where a FnOnce is expected. source