about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@tvl.su>2023-11-02T15·43+0300
committerclbot <clbot@tvl.fyi>2023-11-03T09·24+0000
commit2dd2b844c72a3b8af2671651b7d59e50f6e1b048 (patch)
tree913f6e54419dd73693716bfb77dd6619022dec32
parentd91fcd4f289451b577c9af864cd96843b6e5bf26 (diff)
chore(tvix/eval): add a marker for sorted borrowed attrs iteration r/6931
Similar to `into_iter_sorted`, add a marker function for call sites
that want *borrowed* sorted iteration.

Change-Id: I7c6f14e1ac43fdb14b861b3da183eb5d12bba139
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9899
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
-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 15a709730c..f3638e69c2 100644
--- a/tvix/eval/src/value/attrs.rs
+++ b/tvix/eval/src/value/attrs.rs
@@ -299,6 +299,12 @@ impl NixAttrs {
         })
     }
 
+    /// Same as iter(), but marks call sites which rely on the
+    /// iteration being lexicographic.
+    pub fn iter_sorted<'a>(&'a self) -> Iter<KeyValue<'a>> {
+        self.iter()
+    }
+
     pub fn into_iter(self) -> IntoIter {
         match self.0 {
             AttrsRep::Empty => IntoIter(IntoIterRepr::Empty),