about summary refs log tree commit diff
path: root/tvix/eval
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-10-02T16·19+0300
committertazjin <tazjin@tvl.su>2022-10-03T07·53+0000
commit3c9520a4e56e09c59b007b2965372c7173b4e40d (patch)
tree07716e9cced27789082656a7a9e763c0cc0d1675 /tvix/eval
parent8d95e35ced1de53af0030793b12714ce13c745a6 (diff)
refactor(tvix/eval): implement IntoIterator for NixList r/5021
This is the same code as before, just moved into a trait impl to gain
access to stuff that needs IntoIterator

Change-Id: Iff9375cd05593dd2681fa85ccc7f4554bf944a02
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6842
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval')
-rw-r--r--tvix/eval/src/value/list.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/tvix/eval/src/value/list.rs b/tvix/eval/src/value/list.rs
index 81abb3c07e2f..486b0c3fca76 100644
--- a/tvix/eval/src/value/list.rs
+++ b/tvix/eval/src/value/list.rs
@@ -79,10 +79,6 @@ impl NixList {
         self.0.iter()
     }
 
-    pub fn into_iter(self) -> std::vec::IntoIter<Value> {
-        self.0.into_iter()
-    }
-
     /// Compare `self` against `other` for equality using Nix equality semantics
     pub fn nix_eq(&self, other: &Self, vm: &mut VM) -> Result<bool, ErrorKind> {
         if self.len() != other.len() {
@@ -98,3 +94,12 @@ impl NixList {
         Ok(true)
     }
 }
+
+impl IntoIterator for NixList {
+    type Item = Value;
+    type IntoIter = std::vec::IntoIter<Value>;
+
+    fn into_iter(self) -> std::vec::IntoIter<Value> {
+        self.0.into_iter()
+    }
+}