about summary refs log tree commit diff
path: root/tvix/serde/src/de_tests.rs (follow)
AgeCommit message (Collapse)AuthorFilesLines
2024-02-02 r/7467 refactor(tvix/eval): Box Value::StringAspen Smith1-1/+1
NixString is *quite* large - like 80 bytes - because of the extra capacity value for BString and because of the context. We want to keep Value small since we're passing it around a lot, so let's box the NixString inside Value::String to save on some memory, and make cloning ostensibly a little cheaper Change-Id: I343c8b4e7f61dc3dcbbaba4382efb3b3e5bbabb2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10729 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
2024-01-31 r/7460 fix(tvix): Represent strings as byte arraysAspen Smith1-1/+2
C++ nix uses C-style zero-terminated char pointers to represent strings internally - however, up to this point, tvix has used Rust `String` and `str` for string values. Since those are required to be valid utf-8, we haven't been able to properly represent all the string values that Nix supports. To fix that, this change converts the internal representation of the NixString struct from `Box<str>` to `BString`, from the `bstr` crate - this is a wrapper around a `Vec<u8>` with extra functions for treating that byte vector as a "morally string-like" value, which is basically exactly what we need. Since this changes a pretty fundamental assumption about a pretty core type, there are a *lot* of changes in a lot of places to make this work, but I've tried to keep the general philosophy and intent of most of the code in most places intact. Most notably, there's nothing that's been done to make the derivation stuff in //tvix/glue work with non-utf8 strings everywhere, instead opting to just convert to String/str when passing things into that - there *might* be something to be done there, but I don't know what the rules should be and I don't want to figure them out in this change. To deal with OS-native paths in a way that also works in WASM for tvixbolt, this also adds a dependency on the "os_str_bytes" crate. Fixes: b/189 Fixes: b/337 Change-Id: I5e6eb29c62f47dd91af954f5e12bfc3d186f5526 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10200 Reviewed-by: tazjin <tazjin@tvl.su> Reviewed-by: flokli <flokli@flokli.de> Reviewed-by: sterni <sternenseemann@systemli.org> Autosubmit: aspen <root@gws.fyi> Tested-by: BuildkiteCI
2023-08-20 r/6497 refactor(tvix/serde): cargo clippyFlorian Klink1-11/+11
Change-Id: I3c86225040a04c9cb5702b226b4a5008ae219c42 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9093 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI
2023-06-22 r/6345 fix(tvix/serde): remove unnecessary dependency on genawaiterEvgeny Zemtsov1-2/+1
Change-Id: I52f13c6b508793603bc726353e9bf7d5f12fddf4 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8850 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2023-06-22 r/6344 feat(tvix/eval): allow extending builtins outside of tvix_evalEvgeny Zemtsov1-0/+34
The change allows applications that use tvix_serde for parsing nix-based configuration to extend the language with domain-specific set of features. Change-Id: Ia86612308a167c456ecf03e93fe0fbae55b876a6 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8848 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2023-06-16 r/6325 test(tvix/serde): add a test for from_str_with_configVincent Ambo1-1/+12
Change-Id: I451851f4e01cb6dd0005e55bb852823b618f2ee6 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8809 Autosubmit: tazjin <tazjin@tvl.su> Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
2023-01-04 r/5585 feat(tvix/serde): implement enum deserialisationVincent Ambo1-0/+103
Implements externally tagged enum deserialisation. Other serialisation methods are handled by serde internally using the existing methods. See the tests for examples. Change-Id: Ic4a9da3b5a32ddbb5918b1512e70c3ac5ce64f04 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7721 Tested-by: BuildkiteCI Autosubmit: tazjin <tazjin@tvl.su> Reviewed-by: flokli <flokli@flokli.de>
2023-01-04 r/5584 feat(tvix/serde): add newtype & tuple deserialisationVincent Ambo1-0/+15
Only missing enums at this point, but they're a bit of a beast. Change-Id: I4ad47c034851f9a8794c81f39a5149a8ac1826e8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7716 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de> Autosubmit: tazjin <tazjin@tvl.su>
2023-01-03 r/5576 test(tvix/serde): add initial set of deserialisation testsVincent Ambo1-0/+82
Change-Id: I0a9779edf0296c25d37fb5f75f8fc5852fe00121 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7715 Tested-by: BuildkiteCI Autosubmit: tazjin <tazjin@tvl.su> Reviewed-by: flokli <flokli@flokli.de>