octocrab icon indicating copy to clipboard operation
octocrab copied to clipboard

Support Alternative Runtimes

Open maflcko opened this issue 3 years ago • 3 comments

I want to write a simple single-threaded program that blocks on the API call. Is this possible?

My attempt fails:

use futures_executor::block_on;

fn main() -> octocrab::Result<()> {
    println!("{}", block_on(octocrab::instance().ratelimit().get())?.rate.used);
    Ok(())
}

With:

thread 'main' panicked at 'there is no reactor running, must be called from the context of a Tokio 1.x runtime'

Blockers

  • [x] https://github.com/hyperium/hyper/issues/3110

maflcko avatar Oct 19 '22 11:10 maflcko

Thank you for your issue! It's required until #99 is implemented, closing this as a duplicate of that.

XAMPPRocky avatar Oct 19 '22 11:10 XAMPPRocky

It looks like #99 is closed, but on the latest version (alpha3), the error message is still there

maflcko avatar Apr 13 '23 15:04 maflcko

@MarcoFalke Sorry you're right, we haven't fully replaced Tokio yet, however I do want this library to be runtime agnostic as soon as possible so I've reopened and edited the title to better match the current state.

XAMPPRocky avatar Apr 13 '23 19:04 XAMPPRocky