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 Jun 13, 2024
1 parent 909d617 commit 27248d4
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ jobs:
run: cargo check --all-targets --manifest-path "scylla/Cargo.toml" --features "full-serialization"
- name: Cargo check with all features
run: cargo check --all-targets --manifest-path "scylla/Cargo.toml" --all-features
- name: Cargo check with secret feature
run: cargo check --all-targets --manifest-path "scylla/Cargo.toml" --features "secret"
- name: Cargo check with secrecy-08 feature
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 @@ -15,7 +15,7 @@ byteorder = "1.3.4"
bytes = "1.0.1"
# FIXME: Remove <1.38 once https://github.com/tokio-rs/tokio/issues/6610 is fixed
tokio = { version = ">=1.34, <1.38", 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 @@ -40,7 +40,7 @@ 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"]
Expand All @@ -49,7 +49,7 @@ bigdecimal-04 = ["dep:bigdecimal-04"]
full-serialization = [
"chrono",
"time",
"secret",
"secrecy-08",
"num-bigint-03",
"num-bigint-04",
"bigdecimal-04",
Expand Down
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 @@ -1076,7 +1076,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 @@ -872,10 +872,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 SerializeValue for time::Time {
<CqlTime as SerializeValue>::serialize(&(*me).into(), typ, writer)?
});
}
#[cfg(feature = "secret")]
#[cfg(feature = "secrecy-08")]
impl<V: SerializeValue + Zeroize> SerializeValue 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 @@ -24,7 +24,7 @@ cloud = [
"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"]
Expand All @@ -33,7 +33,7 @@ bigdecimal-04 = ["scylla-cql/bigdecimal-04"]
full-serialization = [
"chrono",
"time",
"secret",
"secrecy-08",
"num-bigint-03",
"num-bigint-04",
"bigdecimal-04",
Expand Down

0 comments on commit 27248d4

Please sign in to comment.