Skip to content

Commit

Permalink
Fix Command<T>::perform to return a Command<T>
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ids1024 authored and hecrj committed Oct 18, 2023
1 parent bc9bb28 commit e0233eb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions runtime/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))))
Expand Down

0 comments on commit e0233eb

Please sign in to comment.