From eaa1b915da8480bf3a86960c94f3667f386aa0f4 Mon Sep 17 00:00:00 2001 From: pablu Date: Wed, 3 Jun 2026 14:10:49 +0200 Subject: wip: browser screen implementation --- src/gentoo/package.rs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'src/gentoo/package.rs') 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 { +// 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 { let (category, name) = s.split_once('/')?; -- cgit 1.3.1