egg-mode-rs / egg-mode

a twitter api crate for rust
https://crates.io/crates/egg-mode
Mozilla Public License 2.0
371 stars 65 forks source link

upgrade hyper/hyper-tls/native-tls/tokio #49

Closed QuietMisdreavus closed 5 years ago

QuietMisdreavus commented 5 years ago

Closes #45, fixes #48

Hopefully this should bring the library up to date with the rest of the ecosystem. I tried to update the blurb on the crate root to talk about how Core::run is gone, but i would like to do a complete docs pass to see if i mention tokio-core or handles anywhere else. >_> That will probably happen after this is on master, though.

EDIT: In any case, there are other non-refactor-y changes that need to happen (cutting user streams, updating DM endpoints) before i'm willing to push a new release anyway.

jonhoo commented 5 years ago

A minor comment about this: in general, you'll want to make a current_thread::Runtime and then re-use it if you're doing many things. Like so:

let mut rt = tokio::runtime::current_thread::Runtime::new()?;
let user = rt.block_on(user::lookup(...))?;
let followers = rt.block_on(user::followers_of(...))?;
rt.run()?;

block_on_all is really just new + block_on + run, but creating a new Runtime isn't free (even for current_thread), and making a new one each time is a little sad.