Skip to content

Commit

Permalink
Fix type-inference in sink::unfold() by specifying more of its types (r…
Browse files Browse the repository at this point in the history
  • Loading branch information
sdroege committed Jan 12, 2021
1 parent b13560b commit 21c467c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion futures-util/src/sink/unfold.rs
Expand Up @@ -35,7 +35,11 @@ pin_project! {
/// unfold.send(5).await?;
/// # Ok::<(), futures::never::Never>(()) }).unwrap();
/// ```
pub fn unfold<T, F, R>(init: T, function: F) -> Unfold<T, F, R> {
pub fn unfold<T, F, R, Item, E>(init: T, function: F) -> Unfold<T, F, R>
where
F: FnMut(T, Item) -> R,
R: Future<Output = Result<T, E>>,
{
Unfold { function, state: UnfoldState::Value { value: init } }
}

Expand Down

0 comments on commit 21c467c

Please sign in to comment.