From 1f98954d2e45e38b1702a7b14db295d72c973363 Mon Sep 17 00:00:00 2001 From: VC Date: Mon, 27 Jul 2020 21:02:10 +0200 Subject: [PATCH] Revert "Use futures instead of tokio (for just one call, sounds more appropriate)" This reverts commit 980932778455716f6e789cb31d773e6f0b45a43e --- Cargo.lock | 4 ++-- Cargo.toml | 4 ++-- src/lib.rs | 7 ++++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 469c4ad..0a528e0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1623,15 +1623,15 @@ dependencies = [ [[package]] name = "scootaloo" -version = "0.2.1" +version = "0.2.0" dependencies = [ "clap", "egg-mode", "elefren", - "futures 0.3.5", "htmlescape", "reqwest", "serde", + "tokio 0.2.13", "toml", ] diff --git a/Cargo.toml b/Cargo.toml index 5994631..e937f5e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "scootaloo" -version = "0.2.1" +version = "0.2.0" authors = ["VC "] edition = "2018" @@ -11,7 +11,7 @@ serde = { version = "1.0", features = ["derive"] } toml = "^0.5" clap = "^2.33" -futures = "^0.3" +tokio = "^0.2" egg-mode = "^0.14" elefren = "^0.20" diff --git a/src/lib.rs b/src/lib.rs index c262876..07ab08b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,8 +9,8 @@ use std::{ error::Error, }; -// futures -use futures::executor::block_on; +//tokio +use tokio::runtime::Runtime; // toml use serde::Deserialize; @@ -77,7 +77,8 @@ fn get_oauth2_token(config: &Config) -> Token { /// Get twitter user timeline fn get_user_timeline(config: &Config, token: Token, lid: Option) -> Result, Box> { // fix the page size to 200 as it is the maximum Twitter authorizes - let (_timeline, feed) = block_on(user_timeline(UserID::from(String::from(&config.twitter.username)), true, false, &token) + let mut rt = Runtime::new()?; + let (_timeline, feed) = rt.block_on(user_timeline(UserID::from(String::from(&config.twitter.username)), true, false, &token) .with_page_size(200) .older(lid))?;