use std::str::FromStr;
#[derive(Debug, Copy, Clone)]
pub struct Interval {
unit: IntervalLetter,
num: u32,
}
#[derive(Debug, Clone)]
pub enum InvalidInterval {
BadUnit(String),
BadNumber(String),
}
impl FromStr for Interval {
type Err = InvalidInterval;
fn from_str(s: &str) -> Result<Self, Self::Err> {
s.get(..)
let unit = s.par
}
}
#[derive(Debug, Copy, Clone)]
pub enum IntervalLetter {
Seconds,
Minutes,
Hours,
Days,
}
impl FromStr for IntervalLetter {
type Err = InvalidInterval;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"S" => Ok(Self::Seconds),
"M" => Ok(Self::Minutes),
"H" => Ok(Self::Hours),
"D" => Ok(Self::Days),
_ => Err(InvalidInterval::BadUnit(s.into())),
}
}
}
#[derive(Debug)]
struct ApiUsage {}