refactor(tvix/eval): simplify NixString representation(s)

Instead of the two different representations (which we don't really
use much), use a `Box<str>` (which potentially shaves another 8 bytes
off `Value`).

NixString values themselves are immutable anyways (which was a
guarantee we already had with `SmolStr`), so this doesn't change
anything else.

Change-Id: I1d8454c056c21ecb0aebc473cfb3ae06cd70dbb6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8151
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2023-02-27 13:32:03 +03:00 committed by tazjin
parent 4bbfeaf1cb
commit 1941082cbb
3 changed files with 37 additions and 65 deletions

View file

@ -84,10 +84,10 @@ fn test_kv_attrs_iter() {
.into_iter()
.map(|(k, v)| (k, v));
let (k, v) = iter.next().unwrap();
assert!(k == NixString::NAME_REF);
assert!(k == *NAME_REF);
assert!(v.to_str().unwrap() == meaning_val.to_str().unwrap());
let (k, v) = iter.next().unwrap();
assert!(k == NixString::VALUE_REF);
assert!(k == *VALUE_REF);
assert!(v.as_int().unwrap() == forty_two_val.as_int().unwrap());
assert!(iter.next().is_none());
}