pub fn get_game_mode(queue_id: i64) -> &'static strExpand description
⚙️ Function: Retrieves the game mode corresponding to a given queue ID.
This function looks up the game mode based on a provided queue_id using a predefined mapping (QUEUE_ID_MAP)
of queue IDs to game modes. If the queue_id is not found in the map, it returns “Unknown”.
§Parameters:
queue_id: Ani64representing the queue ID for which the game mode is being queried.
§Returns:
&'static str: Returns a string slice representing the game mode name corresponding to the queue ID, or “Unknown” if the queue ID is not found.
§Example:
This function can be used to retrieve the game mode based on the queue ID returned from match data:
let queue_id = 420; // Example queue ID for Ranked Solo/Duo
let game_mode = get_game_mode(queue_id);
println!("The game mode is: {}", game_mode);§Notes:
- The function iterates over the
QUEUE_ID_MAP, a predefined list of tuples mapping queue IDs to game modes. - If the queue ID is found in the map, the corresponding game mode is returned immediately.
- If the queue ID is not found, the function defaults to returning “Unknown”.