add support for compact_str
crate
This commit is contained in:
parent
efb74969e2
commit
0b5abbcd0f
5 changed files with 35 additions and 1 deletions
18
Cargo.lock
generated
18
Cargo.lock
generated
|
@ -191,6 +191,21 @@ dependencies = [
|
||||||
"static_assertions",
|
"static_assertions",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "compact_str"
|
||||||
|
version = "0.8.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3b79c4069c6cad78e2e0cdfcbd26275770669fb39fd308a752dc110e83b9af32"
|
||||||
|
dependencies = [
|
||||||
|
"castaway",
|
||||||
|
"cfg-if",
|
||||||
|
"itoa",
|
||||||
|
"rustversion",
|
||||||
|
"ryu",
|
||||||
|
"serde",
|
||||||
|
"static_assertions",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "darling"
|
name = "darling"
|
||||||
version = "0.20.10"
|
version = "0.20.10"
|
||||||
|
@ -326,7 +341,7 @@ version = "0.22.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6a989bd2fd12136080f7825ff410d9239ce84a2a639487fc9d924ee42e2fb84f"
|
checksum = "6a989bd2fd12136080f7825ff410d9239ce84a2a639487fc9d924ee42e2fb84f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"compact_str",
|
"compact_str 0.7.1",
|
||||||
"garde_derive",
|
"garde_derive",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"regex",
|
"regex",
|
||||||
|
@ -837,6 +852,7 @@ dependencies = [
|
||||||
"bigdecimal",
|
"bigdecimal",
|
||||||
"bytes",
|
"bytes",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
"compact_str 0.8.1",
|
||||||
"dyn-clone",
|
"dyn-clone",
|
||||||
"either",
|
"either",
|
||||||
"garde",
|
"garde",
|
||||||
|
|
|
@ -32,6 +32,7 @@ smallvec1 = { version = "1.0", default-features = false, optional = true, packag
|
||||||
smol_str02 = { version = "0.2.1", default-features = false, optional = true, package = "smol_str" }
|
smol_str02 = { version = "0.2.1", default-features = false, optional = true, package = "smol_str" }
|
||||||
url2 = { version = "2.0", default-features = false, optional = true, package = "url" }
|
url2 = { version = "2.0", default-features = false, optional = true, package = "url" }
|
||||||
uuid1 = { version = "1.0", default-features = false, optional = true, package = "uuid" }
|
uuid1 = { version = "1.0", default-features = false, optional = true, package = "uuid" }
|
||||||
|
compact_str08 = { version = "0.8", default-features = false, optional = true, package = "compact_str" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
pretty_assertions = "1.2.1"
|
pretty_assertions = "1.2.1"
|
||||||
|
@ -54,6 +55,7 @@ rust_decimal1 = { version = "1", default-features = false, features = ["serde"],
|
||||||
semver1 = { version = "1.0.9", default-features = false, features = ["serde"], package = "semver" }
|
semver1 = { version = "1.0.9", default-features = false, features = ["serde"], package = "semver" }
|
||||||
smallvec1 = { version = "1.0", default-features = false, features = ["serde"], package = "smallvec" }
|
smallvec1 = { version = "1.0", default-features = false, features = ["serde"], package = "smallvec" }
|
||||||
smol_str02 = { version = "0.2.1", default-features = false, features = ["serde"], package = "smol_str" }
|
smol_str02 = { version = "0.2.1", default-features = false, features = ["serde"], package = "smol_str" }
|
||||||
|
compact_str08 = { version = "0.8", default-features = false, features = ["serde"], package = "compact_str" }
|
||||||
url2 = { version = "2.0", default-features = false, features = ["serde"], package = "url" }
|
url2 = { version = "2.0", default-features = false, features = ["serde"], package = "url" }
|
||||||
uuid1 = { version = "1.0", default-features = false, features = ["serde"], package = "uuid" }
|
uuid1 = { version = "1.0", default-features = false, features = ["serde"], package = "uuid" }
|
||||||
|
|
||||||
|
|
|
@ -83,6 +83,9 @@ forward_impl!((<A: smallvec1::Array> crate::JsonSchema for smallvec1::SmallVec<A
|
||||||
#[cfg(feature = "smol_str02")]
|
#[cfg(feature = "smol_str02")]
|
||||||
forward_impl!(smol_str02::SmolStr => alloc::string::String);
|
forward_impl!(smol_str02::SmolStr => alloc::string::String);
|
||||||
|
|
||||||
|
#[cfg(feature = "compact_str08")]
|
||||||
|
forward_impl!(compact_str08::CompactString => alloc::string::String);
|
||||||
|
|
||||||
#[cfg(feature = "url2")]
|
#[cfg(feature = "url2")]
|
||||||
mod url2;
|
mod url2;
|
||||||
|
|
||||||
|
|
11
schemars/tests/integration/compact_str.rs
Normal file
11
schemars/tests/integration/compact_str.rs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
use compact_str08::CompactString;
|
||||||
|
|
||||||
|
use crate::prelude::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn compact_str() {
|
||||||
|
test!(CompactString)
|
||||||
|
.assert_identical::<String>()
|
||||||
|
.assert_allows_ser_roundtrip(["".into(), "test".into()])
|
||||||
|
.assert_matches_de_roundtrip(arbitrary_values());
|
||||||
|
}
|
|
@ -41,6 +41,8 @@ mod skip;
|
||||||
mod smallvec;
|
mod smallvec;
|
||||||
#[cfg(feature = "smol_str02")]
|
#[cfg(feature = "smol_str02")]
|
||||||
mod smol_str;
|
mod smol_str;
|
||||||
|
#[cfg(feature = "compact_str08")]
|
||||||
|
mod compact_str;
|
||||||
mod std_types;
|
mod std_types;
|
||||||
mod structs;
|
mod structs;
|
||||||
mod transform;
|
mod transform;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue