Skip to content

Commit b008f34

Browse files
authored
Fix type-inference in sink::unfold() by specifying more of its types (#2311)
1 parent 1db2b4e commit b008f34

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

futures-util/src/sink/unfold.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ pin_project! {
3535
/// unfold.send(5).await?;
3636
/// # Ok::<(), futures::never::Never>(()) }).unwrap();
3737
/// ```
38-
pub fn unfold<T, F, R>(init: T, function: F) -> Unfold<T, F, R> {
38+
pub fn unfold<T, F, R, Item, E>(init: T, function: F) -> Unfold<T, F, R>
39+
where
40+
F: FnMut(T, Item) -> R,
41+
R: Future<Output = Result<T, E>>,
42+
{
3943
Unfold {
4044
function,
4145
state: UnfoldState::Value { value: init },

0 commit comments

Comments
 (0)