Add `match_v5::Participant::riot_id_game_name()` helper method

pull/67/head
Mingwei Samuel 2024-03-23 22:19:18 -07:00
parent db7192ce20
commit e07b916a08
1 changed files with 12 additions and 0 deletions

View File

@ -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())
}
}