Created
February 1, 2023 03:54
-
-
Save Enigo/1d5cf853d0d2ea6e1097f3d6a37437fa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::env; | |
pub fn as_string(key: &str) -> String { | |
String::from( | |
env::var(key) | |
.expect(format!("{} should be set", key).as_str()) | |
.as_str(), | |
) | |
} | |
pub fn as_u16(key: &str) -> u16 { | |
as_string(key) | |
.parse::<u16>() | |
.expect(format!("{} should be a valid u16", key).as_str()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment