Skip to content

Commit

Permalink
cargo: rename secret feature to secrecy-08
Browse files Browse the repository at this point in the history
  • Loading branch information
muzarski committed Feb 22, 2024
1 parent d1a5abb commit 979c11e
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Cargo check with all serialization features
run: cargo check --all-targets --manifest-path "scylla/Cargo.toml" --features "full-serialization"
- name: Cargo check with secret feature
run: cargo check --all-targets --manifest-path "scylla/Cargo.toml" --features "secret"
run: cargo check --all-targets --manifest-path "scylla/Cargo.toml" --features "secrecy-08"
- name: Cargo check with chrono feature
run: cargo check --all-targets --manifest-path "scylla/Cargo.toml" --features "chrono"
- name: Cargo check with time feature
Expand Down
6 changes: 3 additions & 3 deletions scylla-cql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ scylla-macros = { version = "0.4.0", path = "../scylla-macros" }
byteorder = "1.3.4"
bytes = "1.0.1"
tokio = { version = "1.12", features = ["io-util", "time"] }
secrecy = { version = "0.8", optional = true }
secrecy-08 = { package = "secrecy", version = "0.8", optional = true }
snap = "1.0"
uuid = "1.0"
thiserror = "1.0"
Expand All @@ -37,10 +37,10 @@ name = "benchmark"
harness = false

[features]
secret = ["secrecy"]
secrecy-08 = ["dep:secrecy-08"]
time = ["dep:time"]
chrono = ["dep:chrono"]
num-bigint-03 = ["dep:num-bigint-03"]
num-bigint-04 = ["dep:num-bigint-04"]
bigdecimal-04 = ["dep:bigdecimal-04"]
full-serialization = ["chrono", "time", "secret", "num-bigint-03", "num-bigint-04", "bigdecimal-04"]
full-serialization = ["chrono", "time", "secrecy-08", "num-bigint-03", "num-bigint-04", "bigdecimal-04"]
6 changes: 3 additions & 3 deletions scylla-cql/src/frame/response/cql_to_rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use uuid::Uuid;
#[cfg(feature = "chrono")]
use chrono::{DateTime, NaiveDate, NaiveTime, Utc};

#[cfg(feature = "secret")]
use secrecy::{Secret, Zeroize};
#[cfg(feature = "secrecy-08")]
use secrecy_08::{Secret, Zeroize};

#[derive(Error, Debug, Clone, PartialEq, Eq)]
pub enum FromRowError {
Expand Down Expand Up @@ -240,7 +240,7 @@ impl FromCqlVal<CqlValue> for time::OffsetDateTime {
}
}

#[cfg(feature = "secret")]
#[cfg(feature = "secrecy-08")]
impl<V: FromCqlVal<CqlValue> + Zeroize> FromCqlVal<CqlValue> for Secret<V> {
fn from_cql(cql_val: CqlValue) -> Result<Self, FromCqlValError> {
Ok(Secret::new(FromCqlVal::from_cql(cql_val)?))
Expand Down
6 changes: 3 additions & 3 deletions scylla-cql/src/frame/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ use super::response::result::CqlValue;
use super::types::vint_encode;
use super::types::RawValue;

#[cfg(feature = "secret")]
use secrecy::{ExposeSecret, Secret, Zeroize};
#[cfg(feature = "secrecy-08")]
use secrecy_08::{ExposeSecret, Secret, Zeroize};

/// Every value being sent in a query must implement this trait
/// serialize() should write the Value as [bytes] to the provided buffer
Expand Down Expand Up @@ -1070,7 +1070,7 @@ impl Value for time::Time {
}
}

#[cfg(feature = "secret")]
#[cfg(feature = "secrecy-08")]
impl<V: Value + Zeroize> Value for Secret<V> {
fn serialize(&self, buf: &mut Vec<u8>) -> Result<(), ValueTooBig> {
self.expose_secret().serialize(buf)
Expand Down
4 changes: 2 additions & 2 deletions scylla-cql/src/frame/value_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -871,10 +871,10 @@ fn cqlvalue_serialization() {
);
}

#[cfg(feature = "secret")]
#[cfg(feature = "secrecy-08")]
#[test]
fn secret_serialization() {
use secrecy::Secret;
use secrecy_08::Secret;
let secret = Secret::new(987654i32);
assert_eq!(
serialized(secret, ColumnType::Int),
Expand Down
6 changes: 3 additions & 3 deletions scylla-cql/src/types/serialize/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use uuid::Uuid;
#[cfg(feature = "chrono")]
use chrono::{DateTime, NaiveDate, NaiveTime, Utc};

#[cfg(feature = "secret")]
use secrecy::{ExposeSecret, Secret, Zeroize};
#[cfg(feature = "secrecy-08")]
use secrecy_08::{ExposeSecret, Secret, Zeroize};

use crate::frame::response::result::{ColumnType, CqlValue};
use crate::frame::types::vint_encode;
Expand Down Expand Up @@ -205,7 +205,7 @@ impl SerializeCql for time::Time {
<CqlTime as SerializeCql>::serialize(&(*me).into(), typ, writer)?
});
}
#[cfg(feature = "secret")]
#[cfg(feature = "secrecy-08")]
impl<V: SerializeCql + Zeroize> SerializeCql for Secret<V> {
fn serialize<'b>(
&self,
Expand Down
4 changes: 2 additions & 2 deletions scylla/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ rustdoc-args = ["--cfg", "docsrs"]
default = []
ssl = ["dep:tokio-openssl", "dep:openssl"]
cloud = ["ssl", "scylla-cql/serde", "dep:serde_yaml", "dep:serde", "dep:url", "dep:base64"]
secret = ["scylla-cql/secret"]
secrecy-08 = ["scylla-cql/secrecy-08"]
chrono = ["scylla-cql/chrono"]
time = ["scylla-cql/time"]
num-bigint-03 = ["scylla-cql/num-bigint-03"]
num-bigint-04 = ["scylla-cql/num-bigint-04"]
bigdecimal-04 = ["scylla-cql/bigdecimal-04"]
full-serialization = ["chrono", "time", "secret", "num-bigint-03", "num-bigint-04", "bigdecimal-04"]
full-serialization = ["chrono", "time", "secrecy-08", "num-bigint-03", "num-bigint-04", "bigdecimal-04"]

[dependencies]
scylla-macros = { version = "0.4.0", path = "../scylla-macros" }
Expand Down

0 comments on commit 979c11e

Please sign in to comment.