pub fn parse_arg<T>(opt_name: &str, opt_val: &str) -> Result<T, String>
where
    T: std::str::FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Display,
{
    match opt_val.parse::<T>() {
        Err(e) => Err(format!("Error parsing {}: {}", opt_name, e)),
        Ok(v) => Ok(v),
    }
}
/// Function to help with parsing a command line argument into some other type.
Function to help with parsing a command line argument into some other type.
Function to help with parsing a command line argument into some other type .
pub fn parse_arg<T>(opt_name: &str, opt_val: &str) -> Result<T, String>
where
    T: std::str::FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Display,
{
    match opt_val.parse::<T>() {
        Err(e) => Err(format!("Error parsing {}: {}", opt_name, e)),
        Ok(v) => Ok(v),
    }
}
pub fn parse_arg < T > ( opt_name : & str , opt_val : & str ) -> Result < T , String > where T : std :: str :: FromStr , < T as std :: str :: FromStr > :: Err : std :: fmt :: Display , { match opt_val . parse :: < T > ( ) { Err ( e ) => Err ( format ! ( " " opt_name e ) ) , Ok ( v ) => Ok ( v ) , } }
Function to help with parsing a command line argument into some other type.
Function to help with parsing a command line argument into some other type .
opt_name
&str
opt_val
&str