diff --git a/src/upload.rs b/src/upload.rs index 6158210..133542d 100644 --- a/src/upload.rs +++ b/src/upload.rs @@ -26,16 +26,11 @@ pub struct ListItem { /// Size of the file in bytes. pub file_size: u64, /// ISO8601 formatted date-time string of the creation timestamp. - #[serde(default = "creation_date_utc_default")] - pub creation_date_utc: String, + pub creation_date_utc: Option, /// ISO8601 formatted date-time string of the expiration timestamp if one exists for this file. pub expires_at_utc: Option, } -fn creation_date_utc_default() -> String { - "info not available".to_string() -} - /// Wrapper around raw data and result. #[derive(Debug)] pub struct UploadResult<'a, T>(pub &'a str, pub Result); @@ -328,12 +323,11 @@ impl<'a> Uploader<'a> { "{:filesize_width$} | {:<19} | {}", file_info.file_name, file_info.file_size, - file_info.creation_date_utc, file_info - .expires_at_utc - .as_ref() - .cloned() - .unwrap_or_default() + .creation_date_utc + .as_deref() + .unwrap_or("info not available"), + file_info.expires_at_utc.as_deref().unwrap_or_default() ) })?; Ok(())