Heh, just realized we could get rid of the futures::ready macro if Poll implemented Try. Works perfectly as it's also an "unwrap or return" pattern. Not sure if it would confusing to some, but then again it's exactly why Try exists. And I use futures::ready! a *lot*.
-
Show this thread
-
E.g. rewrite futures::ready!(self.fut.poll_unpin(cx)) To self.fut.poll_unpin(cx)?
1 reply 0 retweets 0 likesShow this thread -
Tho I'd likely sooner write: Pin::new(&mut self.fut).poll(cx)?; Though I kind of wish Futures et al had an unpin method built in. Or like, a trait to auto-deref into an Unpin variant self.fut.poll(cx)?;
1 reply 0 retweets 0 likesShow this thread -
But that doesn't seem like it's worth the effort because there's more important things to do than making the lives easier for the small group of people manually writing futures. One can dream tho.
1 reply 0 retweets 1 likeShow this thread -
(also I should learn more about pin projections; feel like I can use them effectively, but don't fully get all of it yet)
1 reply 0 retweets 0 likesShow this thread -
Okay yeah so implementing Try for Poll<T> isn't possible because Try is already implemented for Poll<Result<T, E>> :( Guess we'll have to sit this one out until we have
specializations
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=d7ab7634c2c99709c438ddc0c84decc0 …1 reply 0 retweets 1 likeShow this thread
Oh though if Try was implemented for `Result<Poll<T>>` that'd remove 50% of the futures::ready! calls in the codebase I'm working on.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.