From f1a51693fa8f8de046322e6a613080f84c8a8a77 Mon Sep 17 00:00:00 2001 From: Mingwei Samuel Date: Thu, 9 Sep 2021 14:54:02 -0700 Subject: [PATCH] Update README.md doctest --- README.md | 17 ++++++++--------- riven/src/lib.rs | 17 ++++++++--------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 37cc14a..a28c182 100644 --- a/README.md +++ b/README.md @@ -28,11 +28,10 @@ use riven::RiotApi; use riven::consts::PlatformRoute; // Enter tokio async runtime. -let mut rt = tokio::runtime::Runtime::new().unwrap(); +let 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"; - # /* (doc testing) */ let api_key = std::env!("RGAPI_KEY"); + let api_key = std::env!("RGAPI_KEY"); // "RGAPI-01234567-89ab-cdef-0123-456789abcdef"; let riot_api = RiotApi::with_key(api_key); // Get summoner data. @@ -52,7 +51,7 @@ rt.block_on(async { // Print champioon masteries. for (i, mastery) in masteries.iter().take(10).enumerate() { println!("{: >2}) {: <9} {: >7} ({})", i + 1, - mastery.champion_id.to_string(), + mastery.champion_id.name().unwrap_or("UNKNOWN"), mastery.champion_points, mastery.champion_level); } }); @@ -60,14 +59,14 @@ rt.block_on(async { Output: ```text 잘 못 Champion Masteries: - 1) Riven 1219895 (7) - 2) Fiora 229714 (5) + 1) Riven 1236866 (7) + 2) Fiora 230679 (5) 3) Katarina 175985 (5) - 4) Lee Sin 150546 (7) - 5) Jax 100509 (5) + 4) Lee Sin 156070 (7) + 5) Jax 102662 (5) 6) Gnar 76373 (6) 7) Kai'Sa 64271 (5) - 8) Caitlyn 46479 (5) + 8) Caitlyn 46614 (5) 9) Irelia 46465 (5) 10) Vladimir 37176 (5) ``` diff --git a/riven/src/lib.rs b/riven/src/lib.rs index 3e935a9..835d3bd 100644 --- a/riven/src/lib.rs +++ b/riven/src/lib.rs @@ -38,11 +38,10 @@ //! use riven::consts::PlatformRoute; //! //! // Enter tokio async runtime. -//! let mut rt = tokio::runtime::Runtime::new().unwrap(); +//! let 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"; -//! # /* (doc testing) */ let api_key = std::env!("RGAPI_KEY"); +//! let api_key = std::env!("RGAPI_KEY"); // "RGAPI-01234567-89ab-cdef-0123-456789abcdef"; //! let riot_api = RiotApi::with_key(api_key); //! //! // Get summoner data. @@ -62,7 +61,7 @@ //! // Print champioon masteries. //! for (i, mastery) in masteries.iter().take(10).enumerate() { //! println!("{: >2}) {: <9} {: >7} ({})", i + 1, -//! mastery.champion_id.to_string(), +//! mastery.champion_id.name().unwrap_or("UNKNOWN"), //! mastery.champion_points, mastery.champion_level); //! } //! }); @@ -70,14 +69,14 @@ //! Output: //! ```text //! 잘 못 Champion Masteries: -//! 1) Riven 1219895 (7) -//! 2) Fiora 229714 (5) +//! 1) Riven 1236866 (7) +//! 2) Fiora 230679 (5) //! 3) Katarina 175985 (5) -//! 4) Lee Sin 150546 (7) -//! 5) Jax 100509 (5) +//! 4) Lee Sin 156070 (7) +//! 5) Jax 102662 (5) //! 6) Gnar 76373 (6) //! 7) Kai'Sa 64271 (5) -//! 8) Caitlyn 46479 (5) +//! 8) Caitlyn 46614 (5) //! 9) Irelia 46465 (5) //! 10) Vladimir 37176 (5) //! ```