forked from Plugin-JF-Onkostar/osc-variant
Issue #8: Add initial sorting based on form dependencies
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user