Rename SteamIDType to SteamIDFormat default tip

Tue, 23 Feb 2021 00:32:06 -0700

author
Glitchvid <Glitchvid@glitchvid.com>
date
Tue, 23 Feb 2021 00:32:06 -0700
changeset 2
474f76259cf0
parent 1
ad88152b3c76

Rename SteamIDType to SteamIDFormat

src/main.rs file | annotate | diff | comparison | revisions
--- a/src/main.rs	Tue Dec 08 23:46:34 2020 -0700
+++ b/src/main.rs	Tue Feb 23 00:32:06 2021 -0700
@@ -146,24 +146,24 @@
 }
 
 #[derive(Debug, PartialEq)]
-enum SteamIDType{
+enum SteamIDFormat{
     SteamID64,
     SteamID2,
     SteamID3,
 }
 
-fn string_to_steamid_type(steamid: &str) -> Result<SteamIDType, &str> {
+fn string_to_steamid_type(steamid: &str) -> Result<SteamIDFormat, &str> {
     if steamid.parse::<u64>().is_ok() {
-        return Ok(SteamIDType::SteamID64)
+        return Ok(SteamIDFormat::SteamID64)
     }
     let steamid2 = Regex::new(REGEX_STEAMID2).unwrap();
     if steamid2.is_match(steamid) {
-        return Ok(SteamIDType::SteamID2)
+        return Ok(SteamIDFormat::SteamID2)
     }
     
     let steamid3 = Regex::new(REGEX_STEAMID3).unwrap();
     if steamid3.is_match(steamid) {
-        return Ok(SteamIDType::SteamID3)
+        return Ok(SteamIDFormat::SteamID3)
     }
     Err("Unable to parse to any SteamID Format.")
 }
@@ -199,9 +199,9 @@
     match steam_type {
         Ok(steam_type) => {
             match steam_type {
-                SteamIDType::SteamID64 => return Ok(input.parse::<u64>().unwrap()),
-                SteamIDType::SteamID2 => return Ok(steamid2_to_steamid64(input)),
-                SteamIDType::SteamID3 => return Ok(steamid3_to_steamid64(input)),
+                SteamIDFormat::SteamID64 => return Ok(input.parse::<u64>().unwrap()),
+                SteamIDFormat::SteamID2 => return Ok(steamid2_to_steamid64(input)),
+                SteamIDFormat::SteamID3 => return Ok(steamid3_to_steamid64(input)),
             }
         }
         Err(steam_type) => return Err(steam_type)
@@ -270,21 +270,21 @@
             Ok(steam_type) => {
                 println!("Interpreting as {:?}", steam_type );
                 match steam_type {
-                    SteamIDType::SteamID64 => {
+                    SteamIDFormat::SteamID64 => {
                         let mut steamid_object = SteamID::new();
                         steamid_object.set_steamid64(input.parse::<u64>().expect("SteamID64 Not a Number!"));
                         println!("steamID64:\t{}", steamid_object.get_steamid64());
                         println!("steamID:  \t{}", steamid_object.get_steamid2());
                         println!("steamID3: \t{}", steamid_object.get_steamid3());
                     }
-                    SteamIDType::SteamID2 => {
+                    SteamIDFormat::SteamID2 => {
                         let mut steamid_object = SteamID::new();
                         steamid_object.set_steamid64(steamid2_to_steamid64(input));
                         println!("steamID64:\t{}", steamid_object.get_steamid64());
                         println!("steamID:  \t{}", steamid_object.get_steamid2());
                         println!("steamID3: \t{}", steamid_object.get_steamid3());
                     }
-                    SteamIDType::SteamID3 => {
+                    SteamIDFormat::SteamID3 => {
                         let mut steamid_object = SteamID::new();
                         steamid_object.set_steamid64(steamid3_to_steamid64(input));
                         println!("steamID64:\t{}", steamid_object.get_steamid64());

mercurial