diff options
| author | pablu <me@pablu.de> | 2026-06-03 14:10:49 +0200 |
|---|---|---|
| committer | pablu <me@pablu.de> | 2026-06-03 14:10:49 +0200 |
| commit | eaa1b915da8480bf3a86960c94f3667f386aa0f4 (patch) | |
| tree | b85e1d2edb0a507ba480926d12fab074d52bb961 /src/gentoo/package.rs | |
| parent | 81cc9a0b347255629d411323e7ff8fee4d5ec61d (diff) | |
wip: browser screen implementation
Diffstat (limited to 'src/gentoo/package.rs')
| -rw-r--r-- | src/gentoo/package.rs | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/gentoo/package.rs b/src/gentoo/package.rs index 1d41b8c..fcd86eb 100644 --- a/src/gentoo/package.rs +++ b/src/gentoo/package.rs @@ -4,12 +4,34 @@ use chrono::{DateTime, Utc}; use crate::gentoo::UseFlag; -#[derive(Debug, Clone, Hash, Eq, PartialEq)] +#[derive(Debug, Clone, Hash, Eq, PartialEq, Ord, PartialOrd)] pub struct PackageKey { + // Field declaration matters because Ord, and PartialOrd check in order pub category: String, pub name: String, } +// impl Ord for PackageKey { +// fn cmp(&self, other: &Self) -> std::cmp::Ordering { +// let cat_ord = self.category.cmp(&other.category); +// if cat_ord == Ordering::Equal { +// return self.name.cmp(&other.name); +// } +// +// cat_ord +// } +// } +// +// impl PartialOrd for PackageKey { +// fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> { +// match self.category.partial_cmp(&other.category) { +// Some(core::cmp::Ordering::Equal) => {} +// ord => return ord, +// } +// self.name.partial_cmp(&other.name) +// } +// } + impl PackageKey { pub fn from_atom(s: &str) -> Option<Self> { let (category, name) = s.split_once('/')?; |
