Futures explained in 200 lines of Rust
That’s more “Futures in Rust explained in 200 lines (of Rust)”.<p>Explaining futures doesn’t require 200 lines: when a function doesn’t return what you asked for, but a ticket that you can later use to check whether what you asked for is available or exchange for what you asked for, that ticket is called <i>“a future”</i>. Functions returning futures allow you to do some other work while the function does what you asked it to do.<p>I think most won’t need more than that to make sense of <a href="https:&#x2F;&#x2F;docs.oracle.com&#x2F;javase&#x2F;7&#x2F;docs&#x2F;api&#x2F;java&#x2F;util&#x2F;concurrent&#x2F;Future.html" rel="nofollow">https:&#x2F;&#x2F;docs.oracle.com&#x2F;javase&#x2F;7&#x2F;docs&#x2F;api&#x2F;java&#x2F;util&#x2F;concurre...</a> or <a href="http:&#x2F;&#x2F;www.cplusplus.com&#x2F;reference&#x2F;future&#x2F;future&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.cplusplus.com&#x2F;reference&#x2F;future&#x2F;future&#x2F;</a>.<p>However, reading this article _and_ <a href="https:&#x2F;&#x2F;doc.rust-lang.org&#x2F;std&#x2F;future&#x2F;trait.Future.html" rel="nofollow">https:&#x2F;&#x2F;doc.rust-lang.org&#x2F;std&#x2F;future&#x2F;trait.Future.html</a>, I don’t understand why Rust decided to provide a more difficult API (“runtime-implementors can come up with interesting new wake-up mechanisms”, according to <a href="https:&#x2F;&#x2F;cfsamson.github.io&#x2F;books-futures-explained&#x2F;2_waker_context.html" rel="nofollow">https:&#x2F;&#x2F;cfsamson.github.io&#x2F;books-futures-explained&#x2F;2_waker_c...</a>, but an example would help there. I can’t come up with one that can’t be done with the simpler interface)<p>So, what am I missing here? Is this actually used in libraries, or is it something that might end up being YAGNI?