Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors while trying to access subreddit data #18

Closed
magicaltoast opened this issue Oct 19, 2020 · 2 comments
Closed

Errors while trying to access subreddit data #18

magicaltoast opened this issue Oct 19, 2020 · 2 comments

Comments

@magicaltoast
Copy link

Hi, I am new to rust so I am sorry in advance if this issue is my fault.
I was trying to use an example from docs, and I got the following error.

thread 'main' panicked at 'not currently running on the Tokio runtime.'

I did my research and I found out that probably roux expect tokio runtime but when I wrapped the main function with #[tokio::main] I am still getting the same error.

Whole code

use roux::Subreddit;
use tokio;

#[tokio::main]
async fn main() {
    let subreddit = Subreddit::new("rust");
    let rising = subreddit.rising(30, None).await;
    println!("{:?}", rising)
}

Code above is a shortened version of Basic Usage

Environment

  • Rust - 1.47.0
  • Roux - 1.1.3
  • Tokio - 0.3.0, features = ["full"]
  • OS - Manjaro

Thanks in advance for any suggestion or solution <3 Have a nice day :)

@beanpuppy
Copy link
Collaborator

Hey thanks for the report.

There seems to be some sort of issue with the latest Tokio version (0.3) which is a beta release. Judging by the changelog, they made some changes to the runtime API: tokio-rs/tokio#2876 so I think it might be a bug.

Anyway, I suggest to just downgrade to v0.2.22 as I can verify that it worked for me. Let me know how that goes.

@magicaltoast
Copy link
Author

After changing tokio version everything works as expected.
I should have checked cargo.toml, thanks for help, have a nice day 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants