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 <tazjin@tvl.su> Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
This commit is contained in:
parent
8d95e35ced
commit
3c9520a4e5
1 changed files with 9 additions and 4 deletions
|
@ -79,10 +79,6 @@ impl NixList {
|
||||||
self.0.iter()
|
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
|
/// Compare `self` against `other` for equality using Nix equality semantics
|
||||||
pub fn nix_eq(&self, other: &Self, vm: &mut VM) -> Result<bool, ErrorKind> {
|
pub fn nix_eq(&self, other: &Self, vm: &mut VM) -> Result<bool, ErrorKind> {
|
||||||
if self.len() != other.len() {
|
if self.len() != other.len() {
|
||||||
|
@ -98,3 +94,12 @@ impl NixList {
|
||||||
Ok(true)
|
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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue