diff options
author | Vincent Ambo <tazjin@tvl.su> | 2023-11-02T15·43+0300 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2023-11-03T09·24+0000 |
commit | 2dd2b844c72a3b8af2671651b7d59e50f6e1b048 (patch) | |
tree | 913f6e54419dd73693716bfb77dd6619022dec32 /tvix/eval | |
parent | d91fcd4f289451b577c9af864cd96843b6e5bf26 (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
Diffstat (limited to 'tvix/eval')
-rw-r--r-- | tvix/eval/src/value/attrs.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tvix/eval/src/value/attrs.rs b/tvix/eval/src/value/attrs.rs index 15a709730c1c..f3638e69c214 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), |