lib_item implements Ord, PartialOrd
@@ -27,7 +27,7 @@ pub struct LibItemState {
pub no_notif: bool,
}
-#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Ord, PartialOrd)]
+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Ord)]
pub struct LibItem {
#[serde(rename = "_id")]
pub id: String,
@@ -71,6 +71,12 @@ impl LibItem {
}
}
+impl PartialOrd for LibItem {
+ fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
+ Some(self.mtime.cmp(&other.mtime))
+ }
+}
+
fn empty_string_as_none<'de, D, T>(de: D) -> Result<Option<T>, D::Error>
where
D: serde::Deserializer<'de>,
