From 95c9c2ae8b3bf81afaee8f0baf408257c1f60454 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Wed, 4 Jan 2023 21:27:06 +0100 Subject: feat(tvix/derivation): derive Clone, Debug, Eq and PartialEq This allows juggling with Derivation structs in unit tests, and makes it very easy to compare them for equality. Change-Id: I1faf2ec1eefb1a40fcee3c29f04ec47d29f22691 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7758 Tested-by: BuildkiteCI Reviewed-by: tazjin --- tvix/derivation/src/derivation.rs | 2 +- tvix/derivation/src/output.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'tvix/derivation/src') diff --git a/tvix/derivation/src/derivation.rs b/tvix/derivation/src/derivation.rs index a1a05abea601..a9ae4191b2de 100644 --- a/tvix/derivation/src/derivation.rs +++ b/tvix/derivation/src/derivation.rs @@ -7,7 +7,7 @@ use std::{collections::BTreeMap, fmt, fmt::Write, iter::FromIterator}; use tvix_store::nixbase32::NIXBASE32; use tvix_store::nixpath::STORE_DIR; -#[derive(Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] pub struct Derivation { #[serde(rename = "args")] pub arguments: Vec, diff --git a/tvix/derivation/src/output.rs b/tvix/derivation/src/output.rs index 2839110971d2..b038f6b5fc6d 100644 --- a/tvix/derivation/src/output.rs +++ b/tvix/derivation/src/output.rs @@ -1,7 +1,7 @@ use serde::{Deserialize, Serialize}; use tvix_store::nixpath::NixPath; -#[derive(Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] pub struct Output { pub path: String, @@ -9,7 +9,7 @@ pub struct Output { pub hash: Option, } -#[derive(Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] pub struct Hash { #[serde(rename = "hash")] pub digest: String, -- cgit 1.4.1