diff options
Diffstat (limited to 'src/types.rs')
-rw-r--r-- | src/types.rs | 14 |
1 files changed, 11 insertions, 3 deletions
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")] |