summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main.rs2
-rw-r--r--src/types.rs14
2 files changed, 12 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs
index 25968a4..f731cc4 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -32,7 +32,7 @@ fn main() {
for task in opts.tasks {
let task_ref = ctx
- .make_ref(&TaskID(task), &TaskArgs {})
+ .make_ref(&TaskID(task), &TaskArgs(Default::default()))
.expect("Unknown task");
let errors = rsv.add_goal(&task_ref);
if !errors.is_empty() {
diff --git a/src/types.rs b/src/types.rs
index 0cddfe3..5ec91b2 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize};
use sha2::Sha256;
-use std::fmt::Display;
+use std::{collections::HashMap, fmt::Display, hash, rc::Rc};
use crate::util::cjson;
@@ -67,8 +67,16 @@ impl Display for TaskID {
}
}
-#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub struct TaskArgs {}
+#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
+pub struct TaskArgs(pub HashMap<String, Rc<serde_json::Value>>);
+
+impl hash::Hash for TaskArgs {
+ fn hash<H: hash::Hasher>(&self, _state: &mut H) {
+ // Don't do anything: Properly hashing the task args is likely to cost
+ // much more performance than the hash collisions caused by TaskRefs
+ // that only differ by the args
+ }
+}
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")]