about summary refs log tree commit diff
path: root/tvix/glue/src/builtins/fetchers.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-06-10T18·15+0300
committerclbot <clbot@tvl.fyi>2024-06-12T10·30+0000
commite1d3fa240a2adda5db004e32a72baa30b5d4d05a (patch)
tree01ee292dccb1ffb60a672b94342314dd6abce6c1 /tvix/glue/src/builtins/fetchers.rs
parenta7bf5b975f3980677458c8cc5302393343d05fda (diff)
refactor(tvix/glue/fetchers): use named field for structs r/8250
This allows giving more self-speaking names, as well as documenting each
field individually.

Change-Id: Ide164d684b7f819aac279cc8e657c02fc24d093f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11786
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Diffstat (limited to 'tvix/glue/src/builtins/fetchers.rs')
-rw-r--r--tvix/glue/src/builtins/fetchers.rs16
1 files changed, 13 insertions, 3 deletions
diff --git a/tvix/glue/src/builtins/fetchers.rs b/tvix/glue/src/builtins/fetchers.rs
index c7602c03e81f..08a882586e9b 100644
--- a/tvix/glue/src/builtins/fetchers.rs
+++ b/tvix/glue/src/builtins/fetchers.rs
@@ -6,7 +6,6 @@ use crate::{
     tvix_store_io::TvixStoreIO,
 };
 use nix_compat::nixhash;
-use nix_compat::nixhash::NixHash;
 use std::rc::Rc;
 use tracing::info;
 use tvix_eval::builtin_macros::builtins;
@@ -80,6 +79,7 @@ async fn extract_fetch_args(
 #[builtins(state = "Rc<TvixStoreIO>")]
 pub(crate) mod fetcher_builtins {
     use crate::builtins::FetcherError;
+    use nix_compat::nixhash::NixHash;
     use url::Url;
 
     use super::*;
@@ -147,7 +147,10 @@ pub(crate) mod fetcher_builtins {
         fetch_lazy(
             state,
             name,
-            Fetch::URL(url, args.sha256.map(NixHash::Sha256)),
+            Fetch::URL {
+                url,
+                exp_hash: args.sha256.map(NixHash::Sha256),
+            },
         )
     }
 
@@ -172,7 +175,14 @@ pub(crate) mod fetcher_builtins {
         let url = Url::parse(&args.url_str)
             .map_err(|e| ErrorKind::TvixError(Rc::new(FetcherError::InvalidUrl(e))))?;
 
-        fetch_lazy(state, name, Fetch::Tarball(url, args.sha256))
+        fetch_lazy(
+            state,
+            name,
+            Fetch::Tarball {
+                url,
+                exp_nar_sha256: args.sha256,
+            },
+        )
     }
 
     #[builtin("fetchGit")]