From e07b916a0855143a3a4a4c8cd52cf4aeb315684f Mon Sep 17 00:00:00 2001 From: Mingwei Samuel Date: Sat, 23 Mar 2024 22:19:18 -0700 Subject: [PATCH] Add `match_v5::Participant::riot_id_game_name()` helper method --- riven/src/models_impls.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/riven/src/models_impls.rs b/riven/src/models_impls.rs index 1ccc1e5..fea50d7 100644 --- a/riven/src/models_impls.rs +++ b/riven/src/models_impls.rs @@ -18,4 +18,16 @@ impl Participant { #[allow(deprecated)] self.champion_id.or_else(|_| self.champion_name.parse()) } + + /// This method returns the name portion of the riot ID for this summoner. + /// + /// Prior to patch 14.5, this was in the [`Self::riot_id_name`] field. + /// After, this moved to the `Self.riot_id_game_name` field. + /// + /// This method simply returns whichever of the two fields is not `None`. + pub fn riot_id_game_name(&self) -> Option<&str> { + self.riot_id_game_name + .as_deref() + .or(self.riot_id_name.as_deref()) + } }