In this example in my library s3-algo, if you remove this line it works fine:
with .boxed()
there I get errors:
error[E0308]: mismatched types
--> examples/simple.rs:19:6
|
19 | .boxed()
| ^^^^^ one type is more general than the other
|
= note: expected type `std::ops::FnOnce<(std::pin::Pin<std::boxed::Box<dyn core::future::future::Future<Output = std::result::Result<(f64, u64, std::time::Duration, std::time::Duration, usize), s3_algo::err::Error>> + std::marker::Send>>,)>`
found type `std::ops::FnOnce<(std::pin::Pin<std::boxed::Box<dyn core::future::future::Future<Output = std::result::Result<(f64, u64, std::time::Duration, std::time::Duration, usize), s3_algo::err::Error>> + std::marker::Send>>,)>`
error[E0308]: mismatched types
--> examples/simple.rs:19:6
|
7 | let files = (0..N_FILES).map(|i| ObjectSource::data(format!("hey, {}", i), format!("hey{}", i)));
| ------------------------------------------------------------------
| |
| one of the expected closures
| one of the found closures
...
13 | / |result| {
14 | | println!("File {}/{} successfully uploaded", result.seq+1, N_FILES);
15 | | ok(())
16 | | },
| | -
| | |
| |_________one of the expected closures
| one of the found closures
...
19 | .boxed()
| ^^^^^ one type is more general than the other
|
::: /home/erlend/code/s3-algo/src/upload.rs:61:35
|
61 | .then(move |x| async move {
| ___________________________________-
| |___________________________________|
| |
62 | | delay_for(Duration::from_secs(extra_copy_file_time_s)).await;
63 | | x
64 | | })
| | -
| |_________|
| |_________the expected generator
| the found generator
|
= note: expected opaque type `impl core::future::future::Future`
found opaque type `impl core::future::future::Future`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0308`.
error: could not compile `s3-algo`.
I know this has to do with lifetimes, but I have no idea how to solve it in this case.