pub fn to_daily(&self) -> Daily {
        self.update
            .harian
            .iter()
            .map(|source_daily_case| {
                let parsed_case_key =
                    DateTime::parse_from_rfc3339(&source_daily_case.key_as_string).unwrap();

                DailyItem {
                    year: parsed_case_key.year(),
                    month: parsed_case_key.month(),
                    day: parsed_case_key.day(),
                    positive: source_daily_case.jumlah_positif.value,
                    recovered: source_daily_case.jumlah_sembuh.value,
                    deaths: source_daily_case.jumlah_meninggal.value,
                    active: source_daily_case.jumlah_dirawat.value,
                }
            })
            .collect()
    }
/// Convert daily cases JSON structure from source API into our own daily format.
/// ### From
/// ```json
/// {
///     "key_as_string": "2020-03-02T00:00:00.000Z",
///     "key": 1583107200000,
///     "doc_count": 1,
///     "jumlah_meninggal": {
///         "value": 0
///     },
///     "jumlah_sembuh": {
///         "value": 0
///     },
///     "jumlah_positif": {
///         "value": 2
///     },
///     "jumlah_dirawat": {
///         "value": 2
///     },
///     "jumlah_positif_kum": {
///         "value": 2
///     },
///     "jumlah_sembuh_kum": {
///         "value": 0
///     },
///     "jumlah_meninggal_kum": {
///         "value": 0
///     },
///     "jumlah_dirawat_kum": {
///         "value": 2
///     }
/// }
/// ```
/// ### To
/// ```json
/// {
///     "year": 2020,
///     "month": 3,
///     "date": 02,
///     "positive": 2,
///     "recovered": 0,
///     "deaths": 0,
///     "active": 2
/// }
/// ```
Convert daily cases JSON structure from source API into our own daily format.
Convert daily cases JSON structure from source API into our own daily format .
pub fn to_daily(&self) -> Daily {
        self.update
            .harian
            .iter()
            .map(|source_daily_case| {
                let parsed_case_key =
                    DateTime::parse_from_rfc3339(&source_daily_case.key_as_string).unwrap();
                DailyItem {
                    year: parsed_case_key.year(),
                    month: parsed_case_key.month(),
                    day: parsed_case_key.day(),
                    positive: source_daily_case.jumlah_positif.value,
                    recovered: source_daily_case.jumlah_sembuh.value,
                    deaths: source_daily_case.jumlah_meninggal.value,
                    active: source_daily_case.jumlah_dirawat.value,
                }
            })
            .collect()
    }
pub fn to_daily ( & self ) -> Daily { self . update . harian . iter ( ) . map ( | source_daily_case | { let parsed_case_key = DateTime :: parse_from_rfc3339 ( & source_daily_case . key_as_string ) . unwrap ( ) ; DailyItem { year : parsed_case_key . year ( ) , month : parsed_case_key . month ( ) , day : parsed_case_key . day ( ) , positive : source_daily_case . jumlah_positif . value , recovered : source_daily_case . jumlah_sembuh . value , deaths : source_daily_case . jumlah_meninggal . value , active : source_daily_case . jumlah_dirawat . value , } } ) . collect ( ) }
Convert daily cases JSON structure from source API into our own daily format.
Convert daily cases JSON structure from source API into our own daily format .
&self
from
None
to
None