feat(tvix/eval): Implement builtins.fromJSON

Using `serde_json` for parsing JSON here, plus an `impl FromJSON for
Value`. The latter is primarily to stay "dependency light" for now -
likely going with an actual serde `Deserialize` impl in the future is
going to be way better as it allows saving significantly on intermediary
allocations.

Change-Id: I152a0448ff7c87cf7ebaac927c38912b99de1c18
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6920
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
Griffin Smith 2022-10-10 00:32:57 -04:00 committed by grfn
parent 277c69cbe5
commit 5eb89be682
12 changed files with 123 additions and 13 deletions

5
tvix/eval/Cargo.lock generated
View file

@ -997,9 +997,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.85"
version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44"
checksum = "41feea4228a6f1cd09ec7a3593a682276702cd67b5273544757dae23c096f074"
dependencies = [
"itoa 1.0.3",
"ryu",
@ -1211,6 +1211,7 @@ dependencies = [
"rnix",
"rowan",
"rustyline",
"serde_json",
"smol_str",
"tabwriter",
"tempdir",