about summary refs log tree commit diff
path: root/tvix/derivation/src/output.rs
diff options
context:
space:
mode:
authorJürgen Hahn <mail.jhahn@gmail.com>2023-01-02T20·00+0100
committerjrhahn <mail.jhahn@gmail.com>2023-01-02T20·55+0000
commit31973890a9ee60f50c1426ef7173bd4238234268 (patch)
treeef5cf4964fe08b2e0391769c0590738eb184c258 /tvix/derivation/src/output.rs
parente6862413ca032acc94615bd969c8fec49a1a1dc5 (diff)
refactor(tvix/derivation): refactor the derivation serialization r/5564
This refactors the code to serialize a derivation. The original code
has beed moved to seperate crates for better code structure.

Change-Id: I3b1a6b134428fcbc9930c330bced8ec3610cfb4c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7733
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/derivation/src/output.rs')
-rw-r--r--tvix/derivation/src/output.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/tvix/derivation/src/output.rs b/tvix/derivation/src/output.rs
new file mode 100644
index 000000000000..0d764011fc1c
--- /dev/null
+++ b/tvix/derivation/src/output.rs
@@ -0,0 +1,16 @@
+use serde::{Deserialize, Serialize};
+
+// This function is required by serde to deserialize files
+// with missing keys.
+fn default_resource() -> String {
+    "".to_string()
+}
+
+#[derive(Serialize, Deserialize)]
+pub struct Output {
+    pub path: String,
+    #[serde(default = "default_resource")]
+    pub hash_algorithm: String,
+    #[serde(default = "default_resource")]
+    pub hash: String,
+}