re: Rust futures: an uneducated, short and hopefully not boring tutorial - Part 1 VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Hi Francesco. Thanks for the tutorial! Could you please explain why do you use my_fn_squared and not my_fut_squared in the code below? let chain...
 

Hi Andrei,
although there is no difference in the result between these two:

let chained_future = my_fut().and_then(|retval| my_fn_squared(retval));

let chained_future = my_fut().and_then(|retval| my_fut_squared(retval));

The signature is different:

futures::AndThen<impl futures::Future, std::result::Result<u32, std::boxed::Box<dyn std::error::Error>>, [closure@src/main.rs:25:45: 25:75]>

futures::AndThen<impl futures::Future, impl futures::Future, [closure@src/main.rs:30:45: 30:76]>

That said I think you are right, the code I used in the post is misleading. I will correct it right away!

Thank you very much,
Francesco

code of conduct - report abuse