about summary refs log tree commit diff
path: root/tvix/eval
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2023-12-08T09·41-0800
committerclbot <clbot@tvl.fyi>2023-12-09T11·35+0000
commit5fd42a9e70cfbb3e9351d21e9e23df7b0d6feea6 (patch)
treef0ba86e4936e91acd9076fb6f311ec751a44b11b /tvix/eval
parent36c3e646e12622c1be6032f72bc1569d5b6a23d7 (diff)
feat(tvix/eval): impl DoubleEndedIter for OwnedAttrsIterator r/7130
Change-Id: I4bd85dbe9c27047f4abbdeff4e2b796e9bcab3a1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10211
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: Adam Joseph <adam@westernsemico.com>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval')
-rw-r--r--tvix/eval/src/value/attrs.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/tvix/eval/src/value/attrs.rs b/tvix/eval/src/value/attrs.rs
index 10bdee4eba3a..03183810f24b 100644
--- a/tvix/eval/src/value/attrs.rs
+++ b/tvix/eval/src/value/attrs.rs
@@ -615,3 +615,13 @@ impl ExactSizeIterator for OwnedAttrsIterator {
         }
     }
 }
+
+impl DoubleEndedIterator for OwnedAttrsIterator {
+    fn next_back(&mut self) -> Option<Self::Item> {
+        match &mut self.0 {
+            IntoIterRepr::Empty => None,
+            IntoIterRepr::Finite(inner) => inner.next_back(),
+            IntoIterRepr::Im(inner) => inner.next_back(),
+        }
+    }
+}