diff options
author | edef <edef@edef.eu> | 2023-11-10T15·42+0000 |
---|---|---|
committer | edef <edef@edef.eu> | 2023-11-10T19·05+0000 |
commit | 407e5a53ede9c8525c6814fcbb0cb4d07bb4f3f4 (patch) | |
tree | bbe3fd714b0c5b304f753f7f570aa09409120ef7 /tvix | |
parent | 8694694b7452595fee4ed510ce322100aac003b7 (diff) |
feat(nix-compat/narinfo): track presence of unknown fields r/6981
Change-Id: Ia3f8a86209a0045ff98322b56a21ae20220fbe99 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9991 Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
Diffstat (limited to 'tvix')
-rw-r--r-- | tvix/nix-compat/src/narinfo.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tvix/nix-compat/src/narinfo.rs b/tvix/nix-compat/src/narinfo.rs index 6a070b35ac0f..62b0c3524bdf 100644 --- a/tvix/nix-compat/src/narinfo.rs +++ b/tvix/nix-compat/src/narinfo.rs @@ -31,6 +31,7 @@ use crate::{ #[derive(Debug)] pub struct NarInfo<'a> { + pub unknown_fields: bool, // core (authenticated, but unverified here) /// Store path described by this [NarInfo] pub store_path: StorePathRef<'a>, @@ -64,6 +65,8 @@ pub struct NarInfo<'a> { impl<'a> NarInfo<'a> { pub fn parse(input: &'a str) -> Result<Self, Error> { + let mut unknown_fields = false; + let mut store_path = None; let mut url = None; let mut compression = None; @@ -218,12 +221,13 @@ impl<'a> NarInfo<'a> { } } _ => { - // unknown field, ignore + unknown_fields = true; } } } Ok(NarInfo { + unknown_fields, store_path: store_path.ok_or(Error::MissingField("StorePath"))?, nar_hash: nar_hash.ok_or(Error::MissingField("NarHash"))?, nar_size: nar_size.ok_or(Error::MissingField("NarSize"))?, |