ecb_rates/
view.rs

1use crate::ecb_url;
2
3pub enum View {
4    TODAY,
5    HistDays90,
6    HistDaysAll,
7}
8
9impl View {
10    pub fn to_ecb_url(&self) -> &'static str {
11        match self {
12            Self::TODAY => ecb_url::TODAY,
13            Self::HistDays90 => ecb_url::hist::DAYS_90,
14            Self::HistDaysAll => ecb_url::hist::DAYS_ALL,
15        }
16    }
17
18    pub fn get_name(&self) -> &'static str {
19        match self {
20            Self::TODAY => "today",
21            Self::HistDays90 => "last-90-days",
22            Self::HistDaysAll => "all-days",
23        }
24    }
25}