chore(rust): Update dependencies

This commit is contained in:
Dmitry Dygalo 2023-01-15 01:35:33 +01:00 committed by Dmitry Dygalo
parent 4fc6181b27
commit e6a3d749a4
4 changed files with 28 additions and 12 deletions

View File

@ -2,6 +2,12 @@
## [Unreleased]
### Changed
- Bump `base64` to `0.21`.
- Bump `fancy-regex` to `0.11`.
- Bump `fraction` to `0.13`.
## [0.16.1] - 2022-10-20
### Added

View File

@ -51,6 +51,12 @@ version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
[[package]]
name = "base64"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a"
[[package]]
name = "bit-set"
version = "0.5.3"
@ -207,9 +213,9 @@ dependencies = [
[[package]]
name = "fancy-regex"
version = "0.10.0"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0678ab2d46fa5195aaf59ad034c083d351377d4af57f3e073c074d0da3e3c766"
checksum = "b95f7c0680e4142284cf8b22c14a476e87d61b004a3a0861872b32ef7ead40a2"
dependencies = [
"bit-set",
"regex",
@ -232,9 +238,9 @@ dependencies = [
[[package]]
name = "fraction"
version = "0.12.2"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7aa5de57a62c2440ece64342ea59efb7171aa7d016faf8dfcb8795066a17146b"
checksum = "5c37ba08fe22fba12a3ada3e479d09a8f7fac6081aa6f5c27f22b78639025031"
dependencies = [
"lazy_static",
"num",
@ -295,8 +301,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"
dependencies = [
"cfg-if",
"js-sys",
"libc",
"wasi",
"wasm-bindgen",
]
[[package]]
@ -477,10 +485,11 @@ version = "0.16.1"
dependencies = [
"ahash",
"anyhow",
"base64",
"base64 0.21.0",
"bytecount",
"fancy-regex",
"fraction",
"getrandom",
"iso8601",
"itoa",
"lazy_static",
@ -499,7 +508,7 @@ dependencies = [
[[package]]
name = "jsonschema-python"
version = "0.16.1"
version = "0.16.2"
dependencies = [
"built",
"jsonschema",
@ -853,7 +862,7 @@ version = "0.11.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c"
dependencies = [
"base64",
"base64 0.13.1",
"bytes",
"encoding_rs",
"futures-core",

View File

@ -27,11 +27,11 @@ resolve-file = []
[dependencies]
ahash = { version = "0.8", features = ["serde"] }
anyhow = "1.0"
base64 = "0.13"
base64 = "0.21"
bytecount = { version = "0.6", features = ["runtime-dispatch-simd"] }
clap = { version = "4.0", features = ["derive"], optional = true }
fancy-regex = "0.10"
fraction = { version = "0.12", default-features = false, features = ["with-bigint"] }
fancy-regex = "0.11"
fraction = { version = "0.13", default-features = false, features = ["with-bigint"] }
iso8601 = "0.5"
itoa = "1"
lazy_static = "1.4"

View File

@ -1,18 +1,19 @@
use crate::error::ValidationError;
use ahash::AHashMap;
use base64::{engine::general_purpose, Engine as _};
pub(crate) type ContentEncodingCheckType = fn(&str) -> bool;
pub(crate) type ContentEncodingConverterType =
fn(&str) -> Result<Option<String>, ValidationError<'static>>;
pub(crate) fn is_base64(instance_string: &str) -> bool {
base64::decode(instance_string).is_ok()
general_purpose::STANDARD.decode(instance_string).is_ok()
}
pub(crate) fn from_base64(
instance_string: &str,
) -> Result<Option<String>, ValidationError<'static>> {
match base64::decode(instance_string) {
match general_purpose::STANDARD.decode(instance_string) {
Ok(value) => Ok(Some(String::from_utf8(value)?)),
Err(_) => Ok(None),
}