From d6a6e9db830bc22a97e4ec2f1b0cde3c3a45e6c0 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sat, 20 Aug 2022 15:18:19 -0400 Subject: [PATCH] Fix smol_str feature --- postgres-types/Cargo.toml | 4 ++-- postgres-types/src/lib.rs | 2 +- postgres/Cargo.toml | 1 + tokio-postgres/Cargo.toml | 10 +++++++++- tokio-postgres/tests/test/types/mod.rs | 2 ++ tokio-postgres/tests/test/types/smol_str_01.rs | 18 ++++++++++++++++++ 6 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 tokio-postgres/tests/test/types/smol_str_01.rs diff --git a/postgres-types/Cargo.toml b/postgres-types/Cargo.toml index d8464186..70f1ed54 100644 --- a/postgres-types/Cargo.toml +++ b/postgres-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "postgres-types" -version = "0.2.3" +version = "0.2.4" authors = ["Steven Fackler "] edition = "2018" license = "MIT/Apache-2.0" @@ -21,6 +21,7 @@ with-eui48-1 = ["eui48-1"] with-geo-types-0_6 = ["geo-types-06"] with-geo-types-0_7 = ["geo-types-0_7"] with-serde_json-1 = ["serde-1", "serde_json-1"] +with-smol_str-01 = ["smol_str-01"] with-uuid-0_8 = ["uuid-08"] with-uuid-1 = ["uuid-1"] with-time-0_2 = ["time-02"] @@ -48,5 +49,4 @@ uuid-08 = { version = "0.8", package = "uuid", optional = true } uuid-1 = { version = "1.0", package = "uuid", optional = true } time-02 = { version = "0.2", package = "time", optional = true } time-03 = { version = "0.3", package = "time", default-features = false, optional = true } - smol_str-01 = { version = "0.1.23", package = "smol_str", default-features = false, optional = true } diff --git a/postgres-types/src/lib.rs b/postgres-types/src/lib.rs index 5c5a0d02..f5d841cd 100644 --- a/postgres-types/src/lib.rs +++ b/postgres-types/src/lib.rs @@ -224,7 +224,7 @@ mod geo_types_06; mod geo_types_07; #[cfg(feature = "with-serde_json-1")] mod serde_json_1; -#[cfg(feature = "smol_str-01")] +#[cfg(feature = "with-smol_str-01")] mod smol_str_01; #[cfg(feature = "with-time-0_2")] mod time_02; diff --git a/postgres/Cargo.toml b/postgres/Cargo.toml index 15b1b32e..b7f0e2ca 100644 --- a/postgres/Cargo.toml +++ b/postgres/Cargo.toml @@ -29,6 +29,7 @@ with-eui48-1 = ["tokio-postgres/with-eui48-1"] with-geo-types-0_6 = ["tokio-postgres/with-geo-types-0_6"] with-geo-types-0_7 = ["tokio-postgres/with-geo-types-0_7"] with-serde_json-1 = ["tokio-postgres/with-serde_json-1"] +with-smol_str-01 = ["tokio-postgres/with-smol_str-01"] with-uuid-0_8 = ["tokio-postgres/with-uuid-0_8"] with-uuid-1 = ["tokio-postgres/with-uuid-1"] with-time-0_2 = ["tokio-postgres/with-time-0_2"] diff --git a/tokio-postgres/Cargo.toml b/tokio-postgres/Cargo.toml index 57af5676..b2190c9a 100644 --- a/tokio-postgres/Cargo.toml +++ b/tokio-postgres/Cargo.toml @@ -35,6 +35,7 @@ with-eui48-1 = ["postgres-types/with-eui48-1"] with-geo-types-0_6 = ["postgres-types/with-geo-types-0_6"] with-geo-types-0_7 = ["postgres-types/with-geo-types-0_7"] with-serde_json-1 = ["postgres-types/with-serde_json-1"] +with-smol_str-01 = ["postgres-types/with-smol_str-01"] with-uuid-0_8 = ["postgres-types/with-uuid-0_8"] with-uuid-1 = ["postgres-types/with-uuid-1"] with-time-0_2 = ["postgres-types/with-time-0_2"] @@ -62,7 +63,13 @@ tokio-util = { version = "0.7", features = ["codec"] } futures-executor = "0.3" criterion = "0.3" env_logger = "0.9" -tokio = { version = "1.0", features = ["macros", "net", "rt", "rt-multi-thread", "time"] } +tokio = { version = "1.0", features = [ + "macros", + "net", + "rt", + "rt-multi-thread", + "time", +] } bit-vec-06 = { version = "0.6", package = "bit-vec" } chrono-04 = { version = "0.4", package = "chrono", default-features = false } @@ -72,6 +79,7 @@ geo-types-06 = { version = "0.6", package = "geo-types" } geo-types-07 = { version = "0.7", package = "geo-types" } serde-1 = { version = "1.0", package = "serde" } serde_json-1 = { version = "1.0", package = "serde_json" } +smol_str-01 = { version = "0.1", package = "smol_str" } uuid-08 = { version = "0.8", package = "uuid" } uuid-1 = { version = "1.0", package = "uuid" } time-02 = { version = "0.2", package = "time" } diff --git a/tokio-postgres/tests/test/types/mod.rs b/tokio-postgres/tests/test/types/mod.rs index e3fd663a..452d149f 100644 --- a/tokio-postgres/tests/test/types/mod.rs +++ b/tokio-postgres/tests/test/types/mod.rs @@ -27,6 +27,8 @@ mod geo_types_06; mod geo_types_07; #[cfg(feature = "with-serde_json-1")] mod serde_json_1; +#[cfg(feature = "with-smol_str-01")] +mod smol_str_01; #[cfg(feature = "with-time-0_2")] mod time_02; #[cfg(feature = "with-time-0_3")] diff --git a/tokio-postgres/tests/test/types/smol_str_01.rs b/tokio-postgres/tests/test/types/smol_str_01.rs new file mode 100644 index 00000000..843d486b --- /dev/null +++ b/tokio-postgres/tests/test/types/smol_str_01.rs @@ -0,0 +1,18 @@ +use smol_str_01::SmolStr; + +use crate::types::test_type; + +#[tokio::test] +async fn test_smol_str() { + test_type( + "VARCHAR", + &[ + (Some(SmolStr::new("hello world")), "'hello world'"), + ( + Some(SmolStr::new("イロハニホヘト チリヌルヲ")), + "'イロハニホヘト チリヌルヲ'", + ), + (None, "NULL"), + ] + ).await; +}