Fix Command<T>::perform to return a Command<T>

This seems like clearly the correct thing to do here. If the type bound
on `Command` isn't specified, it makes no difference, since the generic
is inferred in a way that works with either definition. But this is
important if `Command<T>` is aliased with a concrete type.
This commit is contained in:
Ian Douglas Scott 2023-08-03 10:19:28 -07:00 committed by Héctor Ramón Jiménez
parent bc9bb28b1c
commit e0233ebc3c
No known key found for this signature in database
GPG key ID: 0BF4EC06CD8E5686

View file

@ -40,9 +40,9 @@ impl<T> Command<T> {
/// Creates a [`Command`] that performs the action of the given future.
pub fn perform<A>(
future: impl Future<Output = T> + 'static + MaybeSend,
f: impl FnOnce(T) -> A + 'static + MaybeSend,
) -> Command<A> {
future: impl Future<Output = A> + 'static + MaybeSend,
f: impl FnOnce(A) -> T + 'static + MaybeSend,
) -> Command<T> {
use iced_futures::futures::FutureExt;
Command::single(Action::Future(Box::pin(future.map(f))))