From 67486f00424fc47ccfa100848c4064c93f0534e0 Mon Sep 17 00:00:00 2001 From: Thomas Eppers Date: Thu, 23 Sep 2021 22:48:04 +0200 Subject: [PATCH 1/2] removed warnings for unused argument --- src/widget/tag_list.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widget/tag_list.rs b/src/widget/tag_list.rs index 7de4408..dccdd6a 100644 --- a/src/widget/tag_list.rs +++ b/src/widget/tag_list.rs @@ -63,7 +63,7 @@ impl TagList { match &self.typ { Type::Status(_) => (), Type::Repo(tags) => match tags.next_page() { - Err(e) => return Err(Error::NoNextPage), + Err(_) => return Err(Error::NoNextPage), Ok(tags) => self.typ = Type::Repo(tags), }, } @@ -75,7 +75,7 @@ impl TagList { match &self.typ { Type::Status(_) => (), Type::Repo(tags) => match tags.prev_page() { - Err(e) => return Err(Error::NoPrevPage), + Err(_) => return Err(Error::NoPrevPage), Ok(tags) => self.typ = Type::Repo(tags), }, } From 7828d7c7036c804cb92d485d8dfe00dc1287b71e Mon Sep 17 00:00:00 2001 From: Thomas Eppers Date: Thu, 23 Sep 2021 22:48:19 +0200 Subject: [PATCH 2/2] added info of architecture and size of images --- src/tags.rs | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/tags.rs b/src/tags.rs index e94969b..41c4385 100644 --- a/src/tags.rs +++ b/src/tags.rs @@ -3,13 +3,19 @@ use std::fmt; use chrono::DateTime; use serde::Deserialize; -#[derive(Deserialize)] +#[derive(Deserialize, Debug)] struct ImageDetails { architecture: String, - os: String, + // os: String, size: usize, } +impl fmt::Display for ImageDetails { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "[{}, {}MB]", self.architecture, self.size / 1024 / 1024) + } +} + #[derive(Deserialize)] pub struct Images { images: Vec, @@ -117,10 +123,22 @@ impl Tags { impl fmt::Display for Images { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + //architecture infos + let mut arch = String::new(); + for image in &self.images { + arch.push_str(&format!("{}", image)); + } + let now = chrono::Utc::now(); let rfc3339 = DateTime::parse_from_rfc3339(&self.last_updated).unwrap(); let dif = now - rfc3339.with_timezone(&chrono::Utc); - write!(f, "{} vor {}", self.tag_name, format_time_nice(dif)) + write!( + f, + "{} vor {} {}", + self.tag_name, + format_time_nice(dif), + arch + ) } }