diff --git a/README.md b/README.md index eb4fbe2..056a5de 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,13 @@ Riven currently uses nightly Rust. use riven::RiotApi; use riven::consts::Region; -async { +// Enter tokio async runtime. +let rt = tokio::runtime::Runtime::new().unwrap(); +rt.block_on(async { // Create RiotApi instance from key. - let riot_api = RiotApi::with_key("RGAPI-01234567-89ab-cdef-0123-456789abcdef"); + let api_key = "RGAPI-01234567-89ab-cdef-0123-456789abcdef"; + # let api_key = std::env::var("RGAPI_KEY").ok().or_else(|| std::fs::read_to_string("apikey.txt").ok()).unwrap(); + let riot_api = RiotApi::with_key(api_key); // Get summoner data. let summoner = riot_api.summoner_v4() @@ -48,10 +52,8 @@ async { mastery.champion_id.to_string(), mastery.champion_points, mastery.champion_level); } -} +}); ``` -Full code in [tests/readme.rs.ignored](./tests/readme.rs.ignored) - Output: ```text 잘 못 Champion Masteries: diff --git a/src/consts/map.rs b/src/consts/map.rs index 624c235..e89ed15 100644 --- a/src/consts/map.rs +++ b/src/consts/map.rs @@ -1,9 +1,9 @@ -/////////////////////////////////////////////// -// // -// ! // -// This file is automatically generated! // -// Do not directly edit! // -// // +/////////////////////////////////////////////// +// // +// ! // +// This file is automatically generated! // +// Do not directly edit! // +// // /////////////////////////////////////////////// use serde_repr::{ Serialize_repr, Deserialize_repr }; diff --git a/tests/async_tests.rs b/tests/async_tests.rs index e38579d..f626cd4 100644 --- a/tests/async_tests.rs +++ b/tests/async_tests.rs @@ -7,7 +7,7 @@ macro_rules! async_tests { env_logger::init(); std::process::exit({ - let mut rt = tokio::runtime::current_thread::Runtime::new() + let rt = tokio::runtime::Runtime::new() .expect("Failed to create runtime."); let (_, errs) = rt.block_on(async { diff --git a/tests/tests_kr.rs.ignored b/tests/tests_kr.rs.ignored index 628f823..0657cd3 100644 --- a/tests/tests_kr.rs.ignored +++ b/tests/tests_kr.rs.ignored @@ -19,7 +19,7 @@ async_tests!{ my_runner { league_summoner_bulk_test: async { - let leagues = (1..20) + let leagues = (1..10) .map(async move |i| { let leaguelist = RIOT_API.league_v4().get_league_entries(REGION, QueueType::RANKED_SOLO_5x5, Tier::GOLD, Division::III, Some(i));