From 3c9520a4e56e09c59b007b2965372c7173b4e40d Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 2 Oct 2022 19:19:13 +0300 Subject: refactor(tvix/eval): implement IntoIterator for NixList 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 Reviewed-by: sterni Tested-by: BuildkiteCI --- tvix/eval/src/value/list.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'tvix/eval/src/value/list.rs') diff --git a/tvix/eval/src/value/list.rs b/tvix/eval/src/value/list.rs index 81abb3c07e..486b0c3fca 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 { - 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 { 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; + + fn into_iter(self) -> std::vec::IntoIter { + self.0.into_iter() + } +} -- cgit 1.4.1