difftreelog
feat add std.equalsIgnoreCase
in: master
Upstream issue: https://github.com/google/go-jsonnet/pull/699
4 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -375,7 +375,9 @@
"serde",
"serde_json",
"serde_yaml_with_quirks",
+ "sha1",
"sha2",
+ "sha3",
"structdump",
]
@@ -388,6 +390,15 @@
]
[[package]]
+name = "keccak"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940"
+dependencies = [
+ "cpufeatures",
+]
+
+[[package]]
name = "libc"
version = "0.2.139"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -676,6 +687,17 @@
]
[[package]]
+name = "sha1"
+version = "0.10.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3"
+dependencies = [
+ "cfg-if",
+ "cpufeatures",
+ "digest",
+]
+
+[[package]]
name = "sha2"
version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -687,6 +709,16 @@
]
[[package]]
+name = "sha3"
+version = "0.10.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60"
+dependencies = [
+ "digest",
+ "keccak",
+]
+
+[[package]]
name = "smallvec"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
crates/jrsonnet-stdlib/Cargo.tomldiffbeforeafterboth1[package]2name = "jrsonnet-stdlib"3description = "jsonnet standard library packaged as crate"4version.workspace = true5repository.workspace = true6authors = ["Yaroslav Bolyukin <iam@lach.pw>"]7license = "MIT"8edition = "2021"910[features]11default = ["codegenerated-stdlib"]12# Speed-up initialization by generating code for parsed stdlib, instead13# of invoking parser for it14codegenerated-stdlib = ["jrsonnet-parser/structdump"]15# Enables legacy `std.thisFile` support, at the cost of worse caching16legacy-this-file = []17# Add order preservation flag to some functions18exp-preserve-order = ["jrsonnet-evaluator/exp-preserve-order"]19# Bigint type20exp-bigint = ["num-bigint", "jrsonnet-evaluator/exp-bigint"]2122[dependencies]23jrsonnet-evaluator.workspace = true24jrsonnet-macros.workspace = true25jrsonnet-parser.workspace = true26jrsonnet-gcmodule.workspace = true2728# Used for stdlib AST serialization29bincode = { version = "1.3", optional = true }30# Used both for stdlib AST serialization and std.parseJson/std.parseYaml31serde = "1.0"3233# std.md534md5 = "0.7.0"35# std.sha256, std.sha51236sha2 = "0.10.6"37# std.base6438base64 = "0.21.0"39# std.parseJson40serde_json = "1.0"41# std.parseYaml, custom library fork is used for C++/golang compatibility42serde_yaml_with_quirks = "0.8.24"4344num-bigint = { version = "0.4.3", optional = true }4546[build-dependencies]47jrsonnet-parser.workspace = true48structdump = { version = "0.2.0", features = ["derive"] }1[package]2name = "jrsonnet-stdlib"3description = "jsonnet standard library packaged as crate"4version.workspace = true5repository.workspace = true6authors = ["Yaroslav Bolyukin <iam@lach.pw>"]7license = "MIT"8edition = "2021"910[features]11default = ["codegenerated-stdlib"]12# Speed-up initialization by generating code for parsed stdlib, instead13# of invoking parser for it14codegenerated-stdlib = ["jrsonnet-parser/structdump"]15# Enables legacy `std.thisFile` support, at the cost of worse caching16legacy-this-file = []17# Add order preservation flag to some functions18exp-preserve-order = ["jrsonnet-evaluator/exp-preserve-order"]19# Bigint type20exp-bigint = ["num-bigint", "jrsonnet-evaluator/exp-bigint"]2122[dependencies]23jrsonnet-evaluator.workspace = true24jrsonnet-macros.workspace = true25jrsonnet-parser.workspace = true26jrsonnet-gcmodule.workspace = true2728# Used for stdlib AST serialization29bincode = { version = "1.3", optional = true }30# Used both for stdlib AST serialization and std.parseJson/std.parseYaml31serde = "1.0"3233# std.md534md5 = "0.7.0"35# std.sha136sha1 = "0.10.5"37# std.sha256, std.sha51238sha2 = "0.10.6"39# std.sha340sha3 = "0.10.8"41# std.base6442base64 = "0.21.0"43# std.parseJson44serde_json = "1.0"45# std.parseYaml, custom library fork is used for C++/golang compatibility46serde_yaml_with_quirks = "0.8.24"4748num-bigint = { version = "0.4.3", optional = true }4950[build-dependencies]51jrsonnet-parser.workspace = true52structdump = { version = "0.2.0", features = ["derive"] }crates/jrsonnet-stdlib/src/hash.rsdiffbeforeafterboth--- a/crates/jrsonnet-stdlib/src/hash.rs
+++ b/crates/jrsonnet-stdlib/src/hash.rs
@@ -16,3 +16,15 @@
use sha2::digest::Digest;
format!("{:x}", sha2::Sha512::digest(s.as_bytes()))
}
+
+#[builtin]
+pub fn builtin_sha1(s: IStr) -> String {
+ use sha1::digest::Digest;
+ format!("{:x}", sha1::Sha1::digest(s.as_bytes()))
+}
+
+#[builtin]
+pub fn builtin_sha3(s: IStr) -> String {
+ use sha3::digest::Digest;
+ format!("{:x}", sha3::Sha3_512::digest(s.as_bytes()))
+}
crates/jrsonnet-stdlib/src/lib.rsdiffbeforeafterboth--- a/crates/jrsonnet-stdlib/src/lib.rs
+++ b/crates/jrsonnet-stdlib/src/lib.rs
@@ -124,8 +124,10 @@
("maxArray", builtin_max_array::INST),
// Hash
("md5", builtin_md5::INST),
+ ("sha1", builtin_sha1::INST),
("sha256", builtin_sha256::INST),
("sha512", builtin_sha512::INST),
+ ("sha3", builtin_sha3::INST),
// Encoding
("encodeUTF8", builtin_encode_utf8::INST),
("decodeUTF8", builtin_decode_utf8::INST),