mirror of
https://framagit.org/veretcle/scootaloo.git
synced 2025-07-20 17:11:19 +02:00
Use futures instead of tokio (for just one call, sounds more appropriate)
This commit is contained in:
4
Cargo.lock
generated
4
Cargo.lock
generated
@@ -1623,15 +1623,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "scootaloo"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"egg-mode",
|
||||
"elefren",
|
||||
"futures 0.3.5",
|
||||
"htmlescape",
|
||||
"reqwest",
|
||||
"serde",
|
||||
"tokio 0.2.13",
|
||||
"toml",
|
||||
]
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "scootaloo"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
authors = ["VC <veretcle+framagit@mateu.be>"]
|
||||
edition = "2018"
|
||||
|
||||
@@ -11,7 +11,7 @@ serde = { version = "1.0", features = ["derive"] }
|
||||
toml = "^0.5"
|
||||
clap = "^2.33"
|
||||
|
||||
tokio = "^0.2"
|
||||
futures = "^0.3"
|
||||
egg-mode = "^0.14"
|
||||
|
||||
elefren = "^0.20"
|
||||
|
@@ -9,8 +9,8 @@ use std::{
|
||||
error::Error,
|
||||
};
|
||||
|
||||
//tokio
|
||||
use tokio::runtime::Runtime;
|
||||
// futures
|
||||
use futures::executor::block_on;
|
||||
|
||||
// toml
|
||||
use serde::Deserialize;
|
||||
@@ -77,8 +77,7 @@ fn get_oauth2_token(config: &Config) -> Token {
|
||||
/// Get twitter user timeline
|
||||
fn get_user_timeline(config: &Config, token: Token, lid: Option<u64>) -> Result<Vec<Tweet>, Box<dyn Error>> {
|
||||
// fix the page size to 200 as it is the maximum Twitter authorizes
|
||||
let mut rt = Runtime::new()?;
|
||||
let (_timeline, feed) = rt.block_on(user_timeline(UserID::from(String::from(&config.twitter.username)), true, false, &token)
|
||||
let (_timeline, feed) = block_on(user_timeline(UserID::from(String::from(&config.twitter.username)), true, false, &token)
|
||||
.with_page_size(200)
|
||||
.older(lid))?;
|
||||
|
||||
|
Reference in New Issue
Block a user