Remove TwitterFuture explicit lifetimes and just clone handle
Closed this issue · 4 comments
Currently TwitterFuture has lifetime dependency due to storing reference to Core's handle.
Any lifetime on Future limits its usability due to the fact that anything aside from Core::run
requires static lifetime on future.
It would be better to just follow hyper's example and clone handle.
User-wise it is not convenient if you'd require to run something more complex than just chain of futures (for example conditionally scheduling jobs using Handle::spawn
).
P.s. coming from my own experience since I required to box multiple futures into array and join instead of just using Handle::spawn
without any boxes :)
This would be awesome. Currently egg-mode can't be used in my use case as I need a 'static
Future and all the methods are bound to the lifetime of the Handle
(which is totally safe to just clone as its reference counted).
You'll be happy to know i'm working on this right now. I'll go through all the futures and make sure it's possible to give them 'static
lifetimes (by using Cow<'a, str>
in some cases, cloning handles and tokens, etc). I totally didn't think about it when i was writing them, and now that it's been brought to my attention, i'll make sure it works out.
Closed in 4e40c3c
It doesn't remove all lifetimes from all the futures in egg-mode - things like Timeline
borrow a Token, so i'll work on that next - but the basic ones should be 'static
now.
That's already cool! Thanks