@@ -373,11 +373,9 @@ impl<T, Output, Progress> Sipper<Output, Progress> for T where
373373
374374/// Creates a new [`Sipper`] from the given async closure, which receives
375375/// a [`Sender`] that can be used to notify progress asynchronously.
376- pub fn sipper < Progress , F > (
377- builder : impl FnOnce ( Sender < Progress > ) -> F ,
378- ) -> impl Sipper < F :: Output , Progress >
376+ pub fn sipper < Progress , F , T > ( builder : F ) -> impl Sipper < T , Progress >
379377where
380- F : Future ,
378+ F : AsyncFnOnce ( Sender < Progress > ) -> T ,
381379{
382380 pin_project ! {
383381 struct Internal <F , Progress >
@@ -507,7 +505,7 @@ mod tests {
507505 }
508506
509507 fn download ( url : & str ) -> impl Sipper < File , Progress > + ' _ {
510- sipper ( move |mut sender| async move {
508+ sipper ( async move |mut sender| {
511509 let _url = url;
512510
513511 for i in 0 ..=100 {
@@ -519,7 +517,7 @@ mod tests {
519517 }
520518
521519 fn try_download ( url : & str ) -> impl Straw < File , Progress , Error > + ' _ {
522- sipper ( move |mut sender| async move {
520+ sipper ( async move |mut sender| {
523521 let _url = url;
524522
525523 for i in 0 ..=42 {
@@ -540,11 +538,13 @@ mod tests {
540538
541539 #[ test]
542540 async fn it_is_a_stream ( ) {
543- assert ! ( download( "https://iced.rs/logo.svg" )
544- . collect:: <Vec <_>>( )
545- . await
546- . into_iter( )
547- . eq( 0 ..=100 ) ) ;
541+ assert ! (
542+ download( "https://iced.rs/logo.svg" )
543+ . collect:: <Vec <_>>( )
544+ . await
545+ . into_iter( )
546+ . eq( 0 ..=100 )
547+ ) ;
548548 }
549549
550550 #[ test]
@@ -556,11 +556,13 @@ mod tests {
556556 let progress = task:: spawn ( receiver. collect :: < Vec < _ > > ( ) ) ;
557557 let file = download ( "https://iced.rs/logo.svg" ) . run ( sender) . await ;
558558
559- assert ! ( progress
560- . await
561- . expect( "Collect progress" )
562- . into_iter( )
563- . eq( 0 ..=100 ) ) ;
559+ assert ! (
560+ progress
561+ . await
562+ . expect( "Collect progress" )
563+ . into_iter( )
564+ . eq( 0 ..=100 )
565+ ) ;
564566
565567 assert_eq ! ( file, File ( vec![ 1 , 2 , 3 , 4 ] ) ) ;
566568 }
@@ -600,7 +602,7 @@ mod tests {
600602 let mut finished = false ;
601603
602604 {
603- let mut download = sipper ( |sender| async {
605+ let mut download = sipper ( async |sender| {
604606 let _ = download ( "https://iced.rs/logo.svg" ) . run ( sender) . await ;
605607
606608 tokio:: task:: yield_now ( ) . await ;
@@ -717,7 +719,7 @@ mod tests {
717719
718720 #[ test]
719721 async fn it_prioritizes_output_over_progress ( ) {
720- let mut infinite_progress = sipper ( |progress| async move {
722+ let mut infinite_progress = sipper ( async |progress| {
721723 drop ( task:: spawn ( {
722724 let mut progress = progress. clone ( ) ;
723725
0 commit comments