forked from mirror/Riven
parent
b4c0432286
commit
cf23db7361
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "riven"
|
||||
version = "0.1.3"
|
||||
version = "0.2.0"
|
||||
authors = ["Mingwei Samuel <mingwei.samuel@gmail.com>"]
|
||||
repository = "https://github.com/MingweiSamuel/Riven"
|
||||
description = "Riot Games API Library"
|
||||
|
@ -26,13 +26,13 @@ nightly = [ "parking_lot/nightly" ]
|
|||
log = "0.4"
|
||||
num_enum = "0.4"
|
||||
parking_lot = "0.9"
|
||||
reqwest = { version = "0.10.0-alpha.2", features = [ "gzip", "json" ] }
|
||||
reqwest = { version = "0.10", features = [ "gzip", "json" ] }
|
||||
scan_fmt = { version = "0.2", default-features = false }
|
||||
serde = { version = "1.0", features = [ "derive" ] }
|
||||
serde_repr = "0.1"
|
||||
strum = "0.16"
|
||||
strum_macros = "0.16"
|
||||
tokio = { version = "0.2.0-alpha.6", default-features = false, features = [ "timer" ] }
|
||||
tokio = { version = "0.2", default-features = false, features = [ "time" ] }
|
||||
url = "2.1"
|
||||
|
||||
[dev-dependencies]
|
||||
|
@ -40,5 +40,4 @@ colored = "1.8"
|
|||
env_logger = "0.7"
|
||||
fake_instant = "0.4"
|
||||
lazy_static = "1.4"
|
||||
tokio = "0.2.0-alpha.6"
|
||||
futures-util-preview = "0.3.0-alpha.19"
|
||||
tokio = "0.2"
|
||||
|
|
|
@ -27,8 +27,8 @@ Data structs and endpoints are automatically generated from the
|
|||
use riven::RiotApi;
|
||||
use riven::consts::Region;
|
||||
|
||||
// Riven Enter tokio async runtime.
|
||||
let rt = tokio::runtime::Runtime::new().unwrap();
|
||||
// Enter tokio async runtime.
|
||||
let mut rt = tokio::runtime::Runtime::new().unwrap();
|
||||
rt.block_on(async {
|
||||
// Create RiotApi instance from key string.
|
||||
let api_key = "RGAPI-01234567-89ab-cdef-0123-456789abcdef";
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::sync::Arc;
|
|||
|
||||
use log;
|
||||
use reqwest::{ Client, StatusCode, Url };
|
||||
use tokio::timer::delay_for;
|
||||
use tokio::time::delay_for;
|
||||
|
||||
use crate::Result;
|
||||
use crate::RiotApiError;
|
||||
|
|
|
@ -7,7 +7,7 @@ macro_rules! async_tests {
|
|||
env_logger::init();
|
||||
|
||||
std::process::exit({
|
||||
let rt = tokio::runtime::Runtime::new()
|
||||
let mut rt = tokio::runtime::Runtime::new()
|
||||
.expect("Failed to create runtime.");
|
||||
|
||||
let (_, errs) = rt.block_on(async {
|
||||
|
@ -23,9 +23,10 @@ macro_rules! async_tests {
|
|||
}.await;
|
||||
result
|
||||
};
|
||||
let $name = tokio::executor::Executor::spawn_with_handle(
|
||||
&mut tokio::executor::DefaultExecutor::current(), $name)
|
||||
.expect("Failed to spawn.");
|
||||
// let $name = tokio_executor::Executor::spawn_with_handle(
|
||||
// &mut tokio_executor::DefaultExecutor::current(), $name)
|
||||
// .expect("Failed to spawn.");
|
||||
let $name = tokio::spawn($name);
|
||||
)*
|
||||
$(
|
||||
let $name = $name.await;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
mod async_tests;
|
||||
mod testutils;
|
||||
use testutils::{ RIOT_API, future_start };
|
||||
use testutils::RIOT_API;
|
||||
|
||||
use colored::*;
|
||||
|
||||
|
@ -24,11 +24,13 @@ async_tests!{
|
|||
|
||||
let sl = ll.entries[..50].iter()
|
||||
.map(|entry| RIOT_API.summoner_v4().get_by_summoner_id(REGION, &entry.summoner_id))
|
||||
.map(future_start)
|
||||
.map(tokio::spawn)
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
for (i, s) in sl.into_iter().enumerate() {
|
||||
let summoner: Summoner = s.await.map_err(|e| e.to_string())?;
|
||||
let summoner: Summoner = s.await
|
||||
.expect("tokio::spawn join error")
|
||||
.map_err(|e| e.to_string())?;
|
||||
println!("{}: {}", i + 1, summoner.name);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
#![allow(dead_code)]
|
||||
|
||||
use std::future::Future;
|
||||
|
||||
use futures_util::future::RemoteHandle;
|
||||
use lazy_static::lazy_static;
|
||||
use tokio::executor::{ DefaultExecutor, Executor };
|
||||
|
||||
use riven::{ RiotApi, RiotApiConfig };
|
||||
|
||||
|
@ -18,15 +14,6 @@ lazy_static! {
|
|||
};
|
||||
}
|
||||
|
||||
pub fn future_start<Fut>(future: Fut) -> RemoteHandle<<Fut as Future>::Output>
|
||||
where
|
||||
Fut: Future + Send + 'static,
|
||||
<Fut as Future>::Output: Send,
|
||||
{
|
||||
Executor::spawn_with_handle(&mut DefaultExecutor::current(), future)
|
||||
.expect("Failed to spawn.")
|
||||
}
|
||||
|
||||
pub mod ids {
|
||||
pub const SUMMONER_ID_LUGNUTSK: &'static str = "SBM8Ubipo4ge2yj7bhEzL7yvV0C9Oc1XA2l6v5okGMA_nCw";
|
||||
pub const SUMMONER_ID_MA5TERY: &'static str = "IbC4uyFEEW3ZkZw6FZF4bViw3P1EynclAcI6-p-vCpI99Ec";
|
||||
|
|
Loading…
Reference in New Issue