Function region_to_string

Source
pub fn region_to_string(region: &Region) -> String
Expand description

⚙️ Function: Converts a Region enum into its corresponding server string representation.

This function takes a reference to a Region enum and returns a string representing the appropriate server for that region. It maps each region to its official server shorthand, which is used in API requests to the Riot Games platform.

§Parameters:

  • region: A reference to a Region enum, representing the different League of Legends regions.

§Returns:

  • String: A string that corresponds to the server shorthand for the provided region.

§Supported Regions:

  • NA: Maps to “na1”
  • EUW: Maps to “euw1”
  • EUNE: Maps to “eun1”
  • KR: Maps to “kr”
  • BR: Maps to “br1”
  • LAN: Maps to “la1”
  • LAS: Maps to “la2”
  • OCE: Maps to “oc1”
  • RU: Maps to “ru”
  • TR: Maps to “tr1”
  • JP: Maps to “jp1”

§Example:

This function can be used when you need to retrieve the corresponding server for a specific region.

let server = region_to_string(&Region::NA);
assert_eq!(server, "na1");