about summary refs log tree commit diff
path: root/tvix/eval/src/value/attrs.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2023-02-26T14·56+0300
committertazjin <tazjin@tvl.su>2023-03-04T15·18+0000
commit8c7d5b4f87e9394dd3acff830e99bce0303b34e6 (patch)
tree359e09b7c771959efbaa516269d7ab6aa5cbf364 /tvix/eval/src/value/attrs.rs
parenta11a3e2c59345172e95d47fa5e7203acdf1110cb (diff)
chore(tvix/eval): implement From<OrdMap<..>> for NixAttrs r/5884
Again simplifying some code down the line, where bits of code that
construct attribute sets already have the final structure available.

Change-Id: I0bb7a1daa63298122b51be73d35d695a4f73f8b0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8140
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/value/attrs.rs')
-rw-r--r--tvix/eval/src/value/attrs.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/tvix/eval/src/value/attrs.rs b/tvix/eval/src/value/attrs.rs
index 9b7a683ce3f7..b9c5adba19b8 100644
--- a/tvix/eval/src/value/attrs.rs
+++ b/tvix/eval/src/value/attrs.rs
@@ -94,6 +94,12 @@ impl AttrsRep {
 #[derive(Clone, Debug, Default)]
 pub struct NixAttrs(pub(super) AttrsRep);
 
+impl From<OrdMap<NixString, Value>> for NixAttrs {
+    fn from(map: OrdMap<NixString, Value>) -> Self {
+        NixAttrs(AttrsRep::Im(map))
+    }
+}
+
 impl<K, V> FromIterator<(K, V)> for NixAttrs
 where
     NixString: From<K>,