Issue #8: Add initial sorting based on form dependencies

This commit is contained in:
2023-09-30 15:06:24 +02:00
parent 86e988c50e
commit 416204b30a
6 changed files with 93 additions and 1 deletions

View File

@@ -22,10 +22,12 @@
* SOFTWARE.
*/
use std::cmp::Ordering;
use std::collections::hash_map::DefaultHasher;
use std::fmt::Debug;
use std::hash::{Hash, Hasher};
use crate::model::requirements::Requires;
use serde::{Deserialize, Serialize};
use crate::profile::{FormField, FormReference, Profile};
@@ -251,6 +253,7 @@ pub trait Listable {
pub trait Sortable {
fn sorting_key(&self) -> String;
fn sorted(&mut self) -> &Self
where
Self: Sized,
@@ -267,6 +270,12 @@ pub trait Comparable: Debug {
format!("{:?}", self).hash(&mut h);
h.finish().to_string()
}
fn compare_by_requirement(_: &Self, _: &Self) -> Ordering
where
Self: Requires,
{
Ordering::Equal
}
}
pub trait FormEntry {