difftreelog
build update dependencies
in: master
10 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -25,15 +25,15 @@
[[package]]
name = "anyhow"
-version = "1.0.66"
+version = "1.0.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6"
+checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61"
[[package]]
name = "async-trait"
-version = "0.1.59"
+version = "0.1.61"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "31e6e93155431f3931513b243d371981bb2770112b370c82745a1d19d2f99364"
+checksum = "705339e0e4a9690e2908d2b3d049d85682cf19fbd5782494498fbf7003a6a282"
dependencies = [
"proc-macro2",
"quote",
@@ -41,17 +41,6 @@
]
[[package]]
-name = "atty"
-version = "0.2.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
-dependencies = [
- "hermit-abi",
- "libc",
- "winapi",
-]
-
-[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -59,9 +48,9 @@
[[package]]
name = "base64"
-version = "0.13.1"
+version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
+checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a"
[[package]]
name = "bincode"
@@ -89,9 +78,9 @@
[[package]]
name = "cc"
-version = "1.0.73"
+version = "1.0.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
+checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d"
[[package]]
name = "cfg-if"
@@ -107,14 +96,14 @@
[[package]]
name = "clap"
-version = "4.0.18"
+version = "4.0.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "335867764ed2de42325fafe6d18b8af74ba97ee0c590fa016f157535b42ab04b"
+checksum = "a7db700bc935f9e43e88d00b0850dae18a63773cfbec6d8e070fccf7fef89a39"
dependencies = [
- "atty",
"bitflags",
"clap_derive",
"clap_lex",
+ "is-terminal",
"once_cell",
"strsim",
"termcolor",
@@ -122,18 +111,18 @@
[[package]]
name = "clap_complete"
-version = "4.0.3"
+version = "4.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dfe581a2035db4174cdbdc91265e1aba50f381577f0510d0ad36c7bc59cc84a3"
+checksum = "10861370d2ba66b0f5989f83ebf35db6421713fd92351790e7fdd6c36774c56b"
dependencies = [
"clap",
]
[[package]]
name = "clap_derive"
-version = "4.0.18"
+version = "4.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "16a1b0f6422af32d5da0c58e2703320f379216ee70198241c84173a8c5ac28f3"
+checksum = "0177313f9f02afc995627906bbd8967e2be069f5261954222dac78290c2b9014"
dependencies = [
"heck",
"proc-macro-error",
@@ -181,15 +170,36 @@
[[package]]
name = "digest"
-version = "0.10.5"
+version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c"
+checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f"
dependencies = [
"block-buffer",
"crypto-common",
]
[[package]]
+name = "errno"
+version = "0.2.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
+dependencies = [
+ "errno-dragonfly",
+ "libc",
+ "winapi",
+]
+
+[[package]]
+name = "errno-dragonfly"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
+dependencies = [
+ "cc",
+ "libc",
+]
+
+[[package]]
name = "generic-array"
version = "0.14.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -207,9 +217,9 @@
[[package]]
name = "hashbrown"
-version = "0.13.1"
+version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "33ff8ae62cd3a9102e5637afc8452c55acf3844001bd5374e0b0bd7b6616c038"
+checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
dependencies = [
"ahash",
]
@@ -222,32 +232,54 @@
[[package]]
name = "hermit-abi"
-version = "0.1.19"
+version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
+checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
dependencies = [
"libc",
]
[[package]]
name = "indexmap"
-version = "1.9.1"
+version = "1.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
+checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"
dependencies = [
"autocfg",
"hashbrown 0.12.3",
]
[[package]]
+name = "io-lifetimes"
+version = "1.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c"
+dependencies = [
+ "libc",
+ "windows-sys",
+]
+
+[[package]]
+name = "is-terminal"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189"
+dependencies = [
+ "hermit-abi",
+ "io-lifetimes",
+ "rustix",
+ "windows-sys",
+]
+
+[[package]]
name = "itoa"
-version = "1.0.4"
+version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc"
+checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440"
[[package]]
name = "jrsonnet"
-version = "0.5.0"
+version = "0.5.0-pre6"
dependencies = [
"clap",
"clap_complete",
@@ -261,7 +293,7 @@
[[package]]
name = "jrsonnet-cli"
-version = "0.5.0"
+version = "0.5.0-pre6"
dependencies = [
"clap",
"jrsonnet-evaluator",
@@ -272,13 +304,13 @@
[[package]]
name = "jrsonnet-evaluator"
-version = "0.5.0"
+version = "0.5.0-pre6"
dependencies = [
"annotate-snippets",
"anyhow",
"async-trait",
"bincode",
- "hashbrown 0.13.1",
+ "hashbrown 0.13.2",
"jrsonnet-gcmodule",
"jrsonnet-interner",
"jrsonnet-macros",
@@ -315,9 +347,9 @@
[[package]]
name = "jrsonnet-interner"
-version = "0.5.0"
+version = "0.5.0-pre6"
dependencies = [
- "hashbrown 0.13.1",
+ "hashbrown 0.13.2",
"jrsonnet-gcmodule",
"rustc-hash",
"serde",
@@ -326,7 +358,7 @@
[[package]]
name = "jrsonnet-macros"
-version = "0.5.0"
+version = "0.5.0-pre6"
dependencies = [
"proc-macro2",
"quote",
@@ -335,7 +367,7 @@
[[package]]
name = "jrsonnet-parser"
-version = "0.5.0"
+version = "0.5.0-pre6"
dependencies = [
"jrsonnet-gcmodule",
"jrsonnet-interner",
@@ -347,7 +379,7 @@
[[package]]
name = "jrsonnet-stdlib"
-version = "0.5.0"
+version = "0.5.0-pre6"
dependencies = [
"base64",
"bincode",
@@ -365,7 +397,7 @@
[[package]]
name = "jrsonnet-types"
-version = "0.5.0"
+version = "0.5.0-pre6"
dependencies = [
"jrsonnet-gcmodule",
"peg",
@@ -373,13 +405,13 @@
[[package]]
name = "libc"
-version = "0.2.137"
+version = "0.2.139"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89"
+checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
[[package]]
name = "libjsonnet"
-version = "0.5.0"
+version = "0.5.0-pre6"
dependencies = [
"jrsonnet-evaluator",
"jrsonnet-gcmodule",
@@ -394,6 +426,12 @@
checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
[[package]]
+name = "linux-raw-sys"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
+
+[[package]]
name = "lock_api"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -429,15 +467,15 @@
[[package]]
name = "once_cell"
-version = "1.15.0"
+version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1"
+checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
[[package]]
name = "os_str_bytes"
-version = "6.3.0"
+version = "6.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff"
+checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee"
[[package]]
name = "parking_lot"
@@ -451,9 +489,9 @@
[[package]]
name = "parking_lot_core"
-version = "0.7.2"
+version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3"
+checksum = "b93f386bb233083c799e6e642a9d73db98c24a5deeb95ffc85bf281255dffc98"
dependencies = [
"cfg-if 0.1.10",
"cloudabi",
@@ -522,18 +560,18 @@
[[package]]
name = "proc-macro2"
-version = "1.0.47"
+version = "1.0.49"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725"
+checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
-version = "1.0.21"
+version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
+checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
dependencies = [
"proc-macro2",
]
@@ -551,10 +589,24 @@
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
+name = "rustix"
+version = "0.36.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4feacf7db682c6c329c4ede12649cd36ecab0f3be5b7d74e6a20304725db4549"
+dependencies = [
+ "bitflags",
+ "errno",
+ "io-lifetimes",
+ "libc",
+ "linux-raw-sys",
+ "windows-sys",
+]
+
+[[package]]
name = "ryu"
-version = "1.0.11"
+version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09"
+checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde"
[[package]]
name = "scopeguard"
@@ -564,18 +616,18 @@
[[package]]
name = "serde"
-version = "1.0.147"
+version = "1.0.152"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965"
+checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
-version = "1.0.147"
+version = "1.0.152"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852"
+checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
dependencies = [
"proc-macro2",
"quote",
@@ -584,9 +636,9 @@
[[package]]
name = "serde_json"
-version = "1.0.87"
+version = "1.0.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45"
+checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883"
dependencies = [
"itoa",
"ryu",
@@ -658,9 +710,9 @@
[[package]]
name = "syn"
-version = "1.0.103"
+version = "1.0.107"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d"
+checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
dependencies = [
"proc-macro2",
"quote",
@@ -688,18 +740,18 @@
[[package]]
name = "thiserror"
-version = "1.0.37"
+version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e"
+checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
-version = "1.0.37"
+version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb"
+checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
dependencies = [
"proc-macro2",
"quote",
@@ -708,15 +760,15 @@
[[package]]
name = "typenum"
-version = "1.15.0"
+version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
+checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
[[package]]
name = "unicode-ident"
-version = "1.0.5"
+version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3"
+checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
[[package]]
name = "unicode-width"
@@ -762,6 +814,63 @@
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
+name = "windows-sys"
+version = "0.42.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
+dependencies = [
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
+]
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.42.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.42.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.42.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.42.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.42.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.42.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.42.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
+
+[[package]]
name = "yaml-rust"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
Cargo.tomldiffbeforeafterboth--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,16 +1,16 @@
[workspace]
-package.version = "0.5.0"
+package.version = "0.5.0-pre6"
members = ["crates/*", "bindings/jsonnet", "cmds/jrsonnet", "tests"]
default-members = ["cmds/jrsonnet"]
[workspace.dependencies]
-jrsonnet-evaluator = { path = "./crates/jrsonnet-evaluator", version = "0.5.0" }
-jrsonnet-macros = { path = "./crates/jrsonnet-macros", version = "0.5.0" }
-jrsonnet-parser = { path = "./crates/jrsonnet-parser", version = "0.5.0" }
-jrsonnet-interner = { path = "./crates/jrsonnet-interner", version = "0.5.0" }
-jrsonnet-stdlib = { path = "./crates/jrsonnet-stdlib", version = "0.5.0" }
-jrsonnet-cli = { path = "./crates/jrsonnet-cli", version = "0.5.0" }
-jrsonnet-types = { path = "./crates/jrsonnet-types", version = "0.5.0" }
+jrsonnet-evaluator = { path = "./crates/jrsonnet-evaluator", version = "0.5.0-pre6" }
+jrsonnet-macros = { path = "./crates/jrsonnet-macros", version = "0.5.0-pre6" }
+jrsonnet-parser = { path = "./crates/jrsonnet-parser", version = "0.5.0-pre6" }
+jrsonnet-interner = { path = "./crates/jrsonnet-interner", version = "0.5.0-pre6" }
+jrsonnet-stdlib = { path = "./crates/jrsonnet-stdlib", version = "0.5.0-pre6" }
+jrsonnet-cli = { path = "./crates/jrsonnet-cli", version = "0.5.0-pre6" }
+jrsonnet-types = { path = "./crates/jrsonnet-types", version = "0.5.0-pre6" }
[profile.test]
opt-level = 1
crates/jrsonnet-evaluator/Cargo.tomldiffbeforeafterboth--- a/crates/jrsonnet-evaluator/Cargo.toml
+++ b/crates/jrsonnet-evaluator/Cargo.toml
@@ -36,7 +36,7 @@
jrsonnet-gcmodule = { version = "0.3.4" }
pathdiff = "0.2.1"
-hashbrown = "0.13.1"
+hashbrown = "0.13.2"
static_assertions = "1.1"
rustc-hash = "1.1"
@@ -53,4 +53,4 @@
# Explaining traces
annotate-snippets = { version = "0.9.1", features = ["color"], optional = true }
# Async imports
-async-trait = { version = "0.1.59", optional = true }
+async-trait = { version = "0.1.60", optional = true }
crates/jrsonnet-evaluator/src/arr/mod.rsdiffbeforeafterboth1use jrsonnet_gcmodule::{Cc, Trace};2use jrsonnet_interner::IBytes;3use jrsonnet_parser::LocExpr;45use crate::{function::FuncVal, Context, Result, Thunk, Val};67mod spec;8use spec::*;910/// Represents a Jsonnet array value.11#[derive(Debug, Clone, Trace)]12// may contrain other ArrValue13#[trace(tracking(force))]14pub enum ArrValue {15 /// Layout optimized byte array.16 Bytes(BytesArray),17 /// Every element is lazy evaluated.18 Lazy(LazyArray),19 /// Every element is defined somewhere in source code20 Expr(ExprArray),21 /// Every field is already evaluated.22 Eager(EagerArray),23 /// Concatenation of two arrays of any kind.24 Extended(Cc<ExtendedArray>),25 /// Represents a integer array in form `[start, start + 1, ... end - 1, end]`.26 /// This kind of arrays is generated by `std.range(start, end)` call, and used for loops.27 Range(RangeArray),28 /// Sliced array view.29 Slice(Cc<SliceArray>),30 /// Reversed array view.31 /// Returned by `std.reverse(other)` call32 Reverse(Cc<ReverseArray>),33 /// Returned by `std.map` call34 Mapped(MappedArray),35 /// Returned by `std.repeat` call36 Repeated(RepeatedArray),37}3839pub trait ArrayLikeIter<T>: Iterator<Item = T> + DoubleEndedIterator + ExactSizeIterator {}40impl<I, T> ArrayLikeIter<T> for I where41 I: Iterator<Item = T> + DoubleEndedIterator + ExactSizeIterator42{43}4445impl ArrValue {46 pub fn empty() -> Self {47 Self::Range(RangeArray::empty())48 }4950 pub fn expr(ctx: Context, exprs: impl IntoIterator<Item = LocExpr>) -> Self {51 Self::Expr(ExprArray::new(ctx, exprs))52 }5354 pub fn lazy(thunks: Cc<Vec<Thunk<Val>>>) -> Self {55 Self::Lazy(LazyArray(thunks))56 }5758 pub fn eager(values: Vec<Val>) -> Self {59 Self::Eager(EagerArray(Cc::new(values)))60 }6162 pub fn repeated(data: ArrValue, repeats: usize) -> Option<Self> {63 Some(Self::Repeated(RepeatedArray::new(data, repeats)?))64 }6566 pub fn bytes(bytes: IBytes) -> Self {67 Self::Bytes(BytesArray(bytes))68 }6970 #[must_use]71 pub fn map(self, mapper: FuncVal) -> Self {72 Self::Mapped(MappedArray::new(self, mapper))73 }7475 pub fn filter(self, filter: impl Fn(&Val) -> Result<bool>) -> Result<Self> {76 // TODO: ArrValue::Picked(inner, indexes) for large arrays77 let mut out = Vec::new();78 for i in self.iter() {79 let i = i?;80 if filter(&i)? {81 out.push(i);82 };83 }84 Ok(Self::eager(out))85 }8687 pub fn extended(a: ArrValue, b: ArrValue) -> Self {88 // TODO: benchmark for an optimal value, currently just a arbitrary choice89 const ARR_EXTEND_THRESHOLD: usize = 100;9091 if a.is_empty() {92 b93 } else if b.is_empty() {94 a95 } else if a.len() + b.len() > ARR_EXTEND_THRESHOLD {96 Self::Extended(Cc::new(ExtendedArray::new(a, b)))97 } else if let (Some(a), Some(b)) = (a.iter_cheap(), b.iter_cheap()) {98 let mut out = Vec::with_capacity(a.len() + b.len());99 out.extend(a);100 out.extend(b);101 Self::eager(out)102 } else {103 let mut out = Vec::with_capacity(a.len() + b.len());104 out.extend(a.iter_lazy());105 out.extend(b.iter_lazy());106 Self::lazy(Cc::new(out))107 }108 }109110 pub fn range_exclusive(a: i32, b: i32) -> Self {111 Self::Range(RangeArray::new_exclusive(a, b))112 }113 pub fn range_inclusive(a: i32, b: i32) -> Self {114 Self::Range(RangeArray::new_inclusive(a, b))115 }116117 #[must_use]118 pub fn slice(119 self,120 from: Option<usize>,121 to: Option<usize>,122 step: Option<usize>,123 ) -> Option<Self> {124 let len = self.len();125 let from = from.unwrap_or(0);126 let to = to.unwrap_or(len).min(len);127 let step = step.unwrap_or(1);128 if from >= to || step == 0 {129 return None;130 }131132 Some(Self::Slice(Cc::new(SliceArray {133 inner: self,134 from: from as u32,135 to: to as u32,136 step: step as u32,137 })))138 }139140 /// Array length.141 pub fn len(&self) -> usize {142 pass!(self.len())143 }144145 /// Is array contains no elements?146 pub fn is_empty(&self) -> bool {147 pass!(self.is_empty())148 }149150 /// Get array element by index, evaluating it, if it is lazy.151 ///152 /// Returns `None` on out-of-bounds condition.153 pub fn get(&self, index: usize) -> Result<Option<Val>> {154 pass!(self.get(index))155 }156157 /// Returns None if get is either non cheap, or out of bounds158 fn get_cheap(&self, index: usize) -> Option<Val> {159 pass!(self.get_cheap(index))160 }161162 /// Get array element by index, without evaluation.163 ///164 /// Returns `None` on out-of-bounds condition.165 pub fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {166 pass!(self.get_lazy(index))167 }168169 #[cfg(feature = "nightly")]170 pub fn iter(&self) -> UnknownArrayIter<'_> {171 pass_iter_call!(self.iter => UnknownArrayIter)172 }173 #[cfg(not(feature = "nightly"))]174 pub fn iter(&self) -> impl ArrayLikeIter<Result<Val>> + '_ {175 (0..self.len()).map(|i| self.get(i).transpose().expect("length checked"))176 }177178 /// Iterate over elements, returning lazy values.179 #[cfg(feature = "nightly")]180 pub fn iter_lazy(&self) -> UnknownArrayIterLazy<'_> {181 pass_iter_call!(self.iter_lazy => UnknownArrayIterLazy)182 }183 #[cfg(not(feature = "nightly"))]184 pub fn iter_lazy(&self) -> impl ArrayLikeIter<Thunk<Val>> + '_ {185 (0..self.len()).map(|i| self.get_lazy(i).expect("length checked"))186 }187188 #[cfg(feature = "nightly")]189 pub fn iter_cheap(&self) -> Option<UnknownArrayIterCheap<'_>> {190 macro_rules! question {191 ($v:expr) => {192 $v?193 };194 }195 Some(pass_iter_call!(self.iter_cheap in question => UnknownArrayIterCheap))196 }197198 #[cfg(not(feature = "nightly"))]199 pub fn iter_cheap(&self) -> Option<impl ArrayLikeIter<Val> + '_> {200 if self.is_cheap() {201 Some((0..self.len()).map(|i| self.get_cheap(i).expect("length and is_cheap checked")))202 } else {203 None204 }205 }206207 /// Return a reversed view on current array.208 #[must_use]209 pub fn reversed(self) -> Self {210 Self::Reverse(Cc::new(ReverseArray(self)))211 }212213 pub fn ptr_eq(a: &Self, b: &Self) -> bool {214 match (a, b) {215 (ArrValue::Bytes(a), ArrValue::Bytes(b)) => a.0 == b.0,216 (ArrValue::Lazy(a), ArrValue::Lazy(b)) => Cc::ptr_eq(&a.0, &b.0),217 (ArrValue::Expr(a), ArrValue::Expr(b)) => Cc::ptr_eq(&a.0, &b.0),218 (ArrValue::Eager(a), ArrValue::Eager(b)) => Cc::ptr_eq(&a.0, &b.0),219 (ArrValue::Extended(a), ArrValue::Extended(b)) => Cc::ptr_eq(a, b),220 (ArrValue::Range(a), ArrValue::Range(b)) => a == b,221 _ => false,222 }223 }224225 pub fn is_cheap(&self) -> bool {226 match self {227 ArrValue::Eager(_) | ArrValue::Range(..) | ArrValue::Bytes(_) => true,228 ArrValue::Extended(v) => v.a.is_cheap() && v.b.is_cheap(),229 ArrValue::Slice(r) => r.inner.is_cheap(),230 ArrValue::Reverse(i) => i.0.is_cheap(),231 ArrValue::Repeated(v) => v.is_cheap(),232 ArrValue::Expr(_) | ArrValue::Lazy(_) | ArrValue::Mapped(_) => false,233 }234 }235}236impl From<Vec<Val>> for ArrValue {237 fn from(value: Vec<Val>) -> Self {238 Self::eager(value)239 }240}241impl From<Vec<Thunk<Val>>> for ArrValue {242 fn from(value: Vec<Thunk<Val>>) -> Self {243 Self::lazy(Cc::new(value))244 }245}246impl FromIterator<Val> for ArrValue {247 fn from_iter<T: IntoIterator<Item = Val>>(iter: T) -> Self {248 Self::eager(iter.into_iter().collect())249 }250}251252#[cfg(target_pointer_width = "64")]253static_assertions::assert_eq_size!(ArrValue, [u8; 16]);1use jrsonnet_gcmodule::{Cc, Trace};2use jrsonnet_interner::IBytes;3use jrsonnet_parser::LocExpr;45use crate::{function::FuncVal, Context, Result, Thunk, Val};67mod spec;8use spec::*;910/// Represents a Jsonnet array value.11#[derive(Debug, Clone, Trace)]12// may contrain other ArrValue13#[trace(tracking(force))]14pub enum ArrValue {15 /// Layout optimized byte array.16 Bytes(BytesArray),17 /// Every element is lazy evaluated.18 Lazy(LazyArray),19 /// Every element is defined somewhere in source code20 Expr(ExprArray),21 /// Every field is already evaluated.22 Eager(EagerArray),23 /// Concatenation of two arrays of any kind.24 Extended(Cc<ExtendedArray>),25 /// Represents a integer array in form `[start, start + 1, ... end - 1, end]`.26 /// This kind of arrays is generated by `std.range(start, end)` call, and used for loops.27 Range(RangeArray),28 /// Sliced array view.29 Slice(Cc<SliceArray>),30 /// Reversed array view.31 /// Returned by `std.reverse(other)` call32 Reverse(Cc<ReverseArray>),33 /// Returned by `std.map` call34 Mapped(MappedArray),35 /// Returned by `std.repeat` call36 Repeated(RepeatedArray),37}3839pub trait ArrayLikeIter<T>: Iterator<Item = T> + DoubleEndedIterator + ExactSizeIterator {}40impl<I, T> ArrayLikeIter<T> for I where41 I: Iterator<Item = T> + DoubleEndedIterator + ExactSizeIterator42{43}4445impl ArrValue {46 pub fn empty() -> Self {47 Self::Range(RangeArray::empty())48 }4950 pub fn expr(ctx: Context, exprs: impl IntoIterator<Item = LocExpr>) -> Self {51 Self::Expr(ExprArray::new(ctx, exprs))52 }5354 pub fn lazy(thunks: Cc<Vec<Thunk<Val>>>) -> Self {55 Self::Lazy(LazyArray(thunks))56 }5758 pub fn eager(values: Vec<Val>) -> Self {59 Self::Eager(EagerArray(Cc::new(values)))60 }6162 pub fn repeated(data: ArrValue, repeats: usize) -> Option<Self> {63 Some(Self::Repeated(RepeatedArray::new(data, repeats)?))64 }6566 pub fn bytes(bytes: IBytes) -> Self {67 Self::Bytes(BytesArray(bytes))68 }6970 #[must_use]71 pub fn map(self, mapper: FuncVal) -> Self {72 Self::Mapped(MappedArray::new(self, mapper))73 }7475 pub fn filter(self, filter: impl Fn(&Val) -> Result<bool>) -> Result<Self> {76 // TODO: ArrValue::Picked(inner, indexes) for large arrays77 let mut out = Vec::new();78 for i in self.iter() {79 let i = i?;80 if filter(&i)? {81 out.push(i);82 };83 }84 Ok(Self::eager(out))85 }8687 pub fn extended(a: ArrValue, b: ArrValue) -> Self {88 // TODO: benchmark for an optimal value, currently just a arbitrary choice89 const ARR_EXTEND_THRESHOLD: usize = 100;9091 if a.is_empty() {92 b93 } else if b.is_empty() {94 a95 } else if a.len() + b.len() > ARR_EXTEND_THRESHOLD {96 Self::Extended(Cc::new(ExtendedArray::new(a, b)))97 } else if let (Some(a), Some(b)) = (a.iter_cheap(), b.iter_cheap()) {98 let mut out = Vec::with_capacity(a.len() + b.len());99 out.extend(a);100 out.extend(b);101 Self::eager(out)102 } else {103 let mut out = Vec::with_capacity(a.len() + b.len());104 out.extend(a.iter_lazy());105 out.extend(b.iter_lazy());106 Self::lazy(Cc::new(out))107 }108 }109110 pub fn range_exclusive(a: i32, b: i32) -> Self {111 Self::Range(RangeArray::new_exclusive(a, b))112 }113 pub fn range_inclusive(a: i32, b: i32) -> Self {114 Self::Range(RangeArray::new_inclusive(a, b))115 }116117 #[must_use]118 pub fn slice(119 self,120 from: Option<usize>,121 to: Option<usize>,122 step: Option<usize>,123 ) -> Option<Self> {124 let len = self.len();125 let from = from.unwrap_or(0);126 let to = to.unwrap_or(len).min(len);127 let step = step.unwrap_or(1);128129 if from >= to || step == 0 {130 return None;131 }132 // match self {133 // ArrValue::Slice(slice) => {134 // return Some(Self::Slice(Cc::new(SliceArray {135 // inner: slice.inner.clone(),136 // from: slice.from + slice.step * (from as u32),137 // to: slice.from + (to as u32) * slice.step,138 // step: slice.step * step as u32,139 // })))140 // }141 // _ => {}142 // }143144 Some(Self::Slice(Cc::new(SliceArray {145 inner: self,146 from: from as u32,147 to: to as u32,148 step: step as u32,149 })))150 }151152 /// Array length.153 pub fn len(&self) -> usize {154 pass!(self.len())155 }156157 /// Is array contains no elements?158 pub fn is_empty(&self) -> bool {159 pass!(self.is_empty())160 }161162 /// Get array element by index, evaluating it, if it is lazy.163 ///164 /// Returns `None` on out-of-bounds condition.165 pub fn get(&self, index: usize) -> Result<Option<Val>> {166 pass!(self.get(index))167 }168169 /// Returns None if get is either non cheap, or out of bounds170 fn get_cheap(&self, index: usize) -> Option<Val> {171 pass!(self.get_cheap(index))172 }173174 /// Get array element by index, without evaluation.175 ///176 /// Returns `None` on out-of-bounds condition.177 pub fn get_lazy(&self, index: usize) -> Option<Thunk<Val>> {178 pass!(self.get_lazy(index))179 }180181 #[cfg(feature = "nightly")]182 pub fn iter(&self) -> UnknownArrayIter<'_> {183 pass_iter_call!(self.iter => UnknownArrayIter)184 }185 #[cfg(not(feature = "nightly"))]186 pub fn iter(&self) -> impl ArrayLikeIter<Result<Val>> + '_ {187 (0..self.len()).map(|i| self.get(i).transpose().expect("length checked"))188 }189190 /// Iterate over elements, returning lazy values.191 #[cfg(feature = "nightly")]192 pub fn iter_lazy(&self) -> UnknownArrayIterLazy<'_> {193 pass_iter_call!(self.iter_lazy => UnknownArrayIterLazy)194 }195 #[cfg(not(feature = "nightly"))]196 pub fn iter_lazy(&self) -> impl ArrayLikeIter<Thunk<Val>> + '_ {197 (0..self.len()).map(|i| self.get_lazy(i).expect("length checked"))198 }199200 #[cfg(feature = "nightly")]201 pub fn iter_cheap(&self) -> Option<UnknownArrayIterCheap<'_>> {202 macro_rules! question {203 ($v:expr) => {204 $v?205 };206 }207 Some(pass_iter_call!(self.iter_cheap in question => UnknownArrayIterCheap))208 }209210 #[cfg(not(feature = "nightly"))]211 pub fn iter_cheap(&self) -> Option<impl ArrayLikeIter<Val> + '_> {212 if self.is_cheap() {213 Some((0..self.len()).map(|i| self.get_cheap(i).expect("length and is_cheap checked")))214 } else {215 None216 }217 }218219 /// Return a reversed view on current array.220 #[must_use]221 pub fn reversed(self) -> Self {222 Self::Reverse(Cc::new(ReverseArray(self)))223 }224225 pub fn ptr_eq(a: &Self, b: &Self) -> bool {226 match (a, b) {227 (ArrValue::Bytes(a), ArrValue::Bytes(b)) => a.0 == b.0,228 (ArrValue::Lazy(a), ArrValue::Lazy(b)) => Cc::ptr_eq(&a.0, &b.0),229 (ArrValue::Expr(a), ArrValue::Expr(b)) => Cc::ptr_eq(&a.0, &b.0),230 (ArrValue::Eager(a), ArrValue::Eager(b)) => Cc::ptr_eq(&a.0, &b.0),231 (ArrValue::Extended(a), ArrValue::Extended(b)) => Cc::ptr_eq(a, b),232 (ArrValue::Range(a), ArrValue::Range(b)) => a == b,233 _ => false,234 }235 }236237 pub fn is_cheap(&self) -> bool {238 match self {239 ArrValue::Eager(_) | ArrValue::Range(..) | ArrValue::Bytes(_) => true,240 ArrValue::Extended(v) => v.a.is_cheap() && v.b.is_cheap(),241 ArrValue::Slice(r) => r.inner.is_cheap(),242 ArrValue::Reverse(i) => i.0.is_cheap(),243 ArrValue::Repeated(v) => v.is_cheap(),244 ArrValue::Expr(_) | ArrValue::Lazy(_) | ArrValue::Mapped(_) => false,245 }246 }247}248impl From<Vec<Val>> for ArrValue {249 fn from(value: Vec<Val>) -> Self {250 Self::eager(value)251 }252}253impl From<Vec<Thunk<Val>>> for ArrValue {254 fn from(value: Vec<Thunk<Val>>) -> Self {255 Self::lazy(Cc::new(value))256 }257}258impl FromIterator<Val> for ArrValue {259 fn from_iter<T: IntoIterator<Item = Val>>(iter: T) -> Self {260 Self::eager(iter.into_iter().collect())261 }262}263264#[cfg(target_pointer_width = "64")]265static_assertions::assert_eq_size!(ArrValue, [u8; 16]);crates/jrsonnet-interner/Cargo.tomldiffbeforeafterboth--- a/crates/jrsonnet-interner/Cargo.toml
+++ b/crates/jrsonnet-interner/Cargo.toml
@@ -22,4 +22,4 @@
structdump = { version = "0.2.0", optional = true }
rustc-hash = "1.1"
-hashbrown = { version = "0.13.1", features = ["inline-more"] }
+hashbrown = { version = "0.13.2", features = ["inline-more"] }
crates/jrsonnet-macros/Cargo.tomldiffbeforeafterboth--- a/crates/jrsonnet-macros/Cargo.toml
+++ b/crates/jrsonnet-macros/Cargo.toml
@@ -1,5 +1,8 @@
[package]
name = "jrsonnet-macros"
+description = "Macros to reduce boilerplate in jrsonnet-evaluator usage"
+authors = ["Yaroslav Bolyukin <iam@lach.pw>"]
+license = "MIT"
version.workspace = true
edition = "2021"
crates/jrsonnet-parser/Cargo.tomldiffbeforeafterboth--- a/crates/jrsonnet-parser/Cargo.toml
+++ b/crates/jrsonnet-parser/Cargo.toml
@@ -31,7 +31,7 @@
static_assertions = "1.1"
-peg = "0.8.0"
+peg = "0.8.1"
serde = { version = "1.0", features = ["derive", "rc"], optional = true }
structdump = { version = "0.2.0", features = ["derive"], optional = true }
crates/jrsonnet-stdlib/Cargo.tomldiffbeforeafterboth--- a/crates/jrsonnet-stdlib/Cargo.toml
+++ b/crates/jrsonnet-stdlib/Cargo.toml
@@ -31,7 +31,7 @@
# std.md5
md5 = "0.7.0"
# std.base64
-base64 = "0.13.1"
+base64 = "0.21.0"
# std.parseJson
serde_json = "1.0"
# std.parseYaml, custom library fork is used for C++/golang compatibility
flake.lockdiffbeforeafterboth--- a/flake.lock
+++ b/flake.lock
@@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1670089411,
- "narHash": "sha256-iiW+L7iN8At8s98qb2h1P8Z0BVTZLqY8KHpfZuM7ULQ=",
+ "lastModified": 1673199114,
+ "narHash": "sha256-8y6ZacZfnBoBBQWcnncqAKHhONFqrfEsqol0oU7KRRs=",
"owner": "nixos",
"repo": "nixpkgs",
- "rev": "ffa4eb958a435e9833bda0fdfc834e87232aa879",
+ "rev": "87ebf1654e1f1345b8abfb5c4410e3671208d3be",
"type": "github"
},
"original": {
@@ -47,11 +47,11 @@
]
},
"locked": {
- "lastModified": 1670034122,
- "narHash": "sha256-EqmuOKucPWtMvCZtHraHr3Q3bgVszq1x2PoZtQkUuEk=",
+ "lastModified": 1673144952,
+ "narHash": "sha256-FqSkt+4BP1562dCeN3FoWEXzQ74+9yVeMnypNyC4aYk=",
"owner": "oxalica",
"repo": "rust-overlay",
- "rev": "a0d5773275ecd4f141d792d3a0376277c0fc0b65",
+ "rev": "07c10018a48b637d9864030468679adaeb18ab95",
"type": "github"
},
"original": {
flake.nixdiffbeforeafterboth--- a/flake.nix
+++ b/flake.nix
@@ -16,7 +16,7 @@
inherit system;
overlays = [ rust-overlay.overlays.default ];
};
- rust = ((pkgs.rustChannelOf { date = "2022-11-19"; channel = "nightly"; }).default.override {
+ rust = ((pkgs.rustChannelOf { date = "2023-01-06"; channel = "nightly"; }).default.override {
extensions = [ "rust-src" "miri" ];
});
in