Skip to content

Commit 9e014b7

Browse files
committed
cargo: rename secret feature to secrecy-08
1 parent 909d617 commit 9e014b7

File tree

8 files changed

+22
-30
lines changed

8 files changed

+22
-30
lines changed

.github/workflows/rust.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ jobs:
4444
run: cargo check --all-targets --manifest-path "scylla/Cargo.toml" --features "full-serialization"
4545
- name: Cargo check with all features
4646
run: cargo check --all-targets --manifest-path "scylla/Cargo.toml" --all-features
47-
- name: Cargo check with secret feature
48-
run: cargo check --all-targets --manifest-path "scylla/Cargo.toml" --features "secret"
47+
- name: Cargo check with secrecy-08 feature
48+
run: cargo check --all-targets --manifest-path "scylla/Cargo.toml" --features "secrecy-08"
4949
- name: Cargo check with chrono feature
5050
run: cargo check --all-targets --manifest-path "scylla/Cargo.toml" --features "chrono"
5151
- name: Cargo check with time feature

scylla-cql/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ byteorder = "1.3.4"
1515
bytes = "1.0.1"
1616
# FIXME: Remove <1.38 once https://github.com/tokio-rs/tokio/issues/6610 is fixed
1717
tokio = { version = ">=1.34, <1.38", features = ["io-util", "time"] }
18-
secrecy = { version = "0.8", optional = true }
18+
secrecy-08 = { package = "secrecy", version = "0.8", optional = true }
1919
snap = "1.0"
2020
uuid = "1.0"
2121
thiserror = "1.0"
@@ -40,7 +40,7 @@ name = "benchmark"
4040
harness = false
4141

4242
[features]
43-
secret = ["secrecy"]
43+
secrecy-08 = ["dep:secrecy-08"]
4444
time = ["dep:time"]
4545
chrono = ["dep:chrono"]
4646
num-bigint-03 = ["dep:num-bigint-03"]
@@ -49,7 +49,7 @@ bigdecimal-04 = ["dep:bigdecimal-04"]
4949
full-serialization = [
5050
"chrono",
5151
"time",
52-
"secret",
52+
"secrecy-08",
5353
"num-bigint-03",
5454
"num-bigint-04",
5555
"bigdecimal-04",

scylla-cql/src/frame/response/cql_to_rust.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ use uuid::Uuid;
1111
#[cfg(feature = "chrono")]
1212
use chrono::{DateTime, NaiveDate, NaiveTime, Utc};
1313

14-
#[cfg(feature = "secret")]
15-
use secrecy::{Secret, Zeroize};
16-
1714
#[derive(Error, Debug, Clone, PartialEq, Eq)]
1815
pub enum FromRowError {
1916
#[error("{err} in the column with index {column}")]
@@ -240,10 +237,10 @@ impl FromCqlVal<CqlValue> for time::OffsetDateTime {
240237
}
241238
}
242239

243-
#[cfg(feature = "secret")]
244-
impl<V: FromCqlVal<CqlValue> + Zeroize> FromCqlVal<CqlValue> for Secret<V> {
240+
#[cfg(feature = "secrecy-08")]
241+
impl<V: FromCqlVal<CqlValue> + secrecy_08::Zeroize> FromCqlVal<CqlValue> for secrecy_08::Secret<V> {
245242
fn from_cql(cql_val: CqlValue) -> Result<Self, FromCqlValError> {
246-
Ok(Secret::new(FromCqlVal::from_cql(cql_val)?))
243+
Ok(secrecy_08::Secret::new(FromCqlVal::from_cql(cql_val)?))
247244
}
248245
}
249246

scylla-cql/src/frame/value.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ use super::response::result::CqlValue;
1616
use super::types::vint_encode;
1717
use super::types::RawValue;
1818

19-
#[cfg(feature = "secret")]
20-
use secrecy::{ExposeSecret, Secret, Zeroize};
21-
2219
/// Every value being sent in a query must implement this trait
2320
/// serialize() should write the Value as [bytes] to the provided buffer
2421
pub trait Value {
@@ -1076,9 +1073,10 @@ impl Value for time::Time {
10761073
}
10771074
}
10781075

1079-
#[cfg(feature = "secret")]
1080-
impl<V: Value + Zeroize> Value for Secret<V> {
1076+
#[cfg(feature = "secrecy-08")]
1077+
impl<V: Value + secrecy_08::Zeroize> Value for secrecy_08::Secret<V> {
10811078
fn serialize(&self, buf: &mut Vec<u8>) -> Result<(), ValueTooBig> {
1079+
use secrecy_08::ExposeSecret;
10821080
self.expose_secret().serialize(buf)
10831081
}
10841082
}

scylla-cql/src/frame/value_tests.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -872,11 +872,10 @@ fn cqlvalue_serialization() {
872872
);
873873
}
874874

875-
#[cfg(feature = "secret")]
875+
#[cfg(feature = "secrecy-08")]
876876
#[test]
877877
fn secret_serialization() {
878-
use secrecy::Secret;
879-
let secret = Secret::new(987654i32);
878+
let secret = secrecy_08::Secret::new(987654i32);
880879
assert_eq!(
881880
serialized(secret, ColumnType::Int),
882881
vec![0, 0, 0, 4, 0x00, 0x0f, 0x12, 0x06]

scylla-cql/src/types/deserialize/value.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -616,10 +616,10 @@ impl_emptiable_strict_type!(
616616
);
617617

618618
// secrecy
619-
#[cfg(feature = "secret")]
620-
impl<'frame, T> DeserializeValue<'frame> for secrecy::Secret<T>
619+
#[cfg(feature = "secrecy-08")]
620+
impl<'frame, T> DeserializeValue<'frame> for secrecy_08::Secret<T>
621621
where
622-
T: DeserializeValue<'frame> + secrecy::Zeroize,
622+
T: DeserializeValue<'frame> + secrecy_08::Zeroize,
623623
{
624624
fn type_check(typ: &ColumnType) -> Result<(), TypeCheckError> {
625625
<T as DeserializeValue<'frame>>::type_check(typ)
@@ -629,7 +629,7 @@ where
629629
typ: &'frame ColumnType,
630630
v: Option<FrameSlice<'frame>>,
631631
) -> Result<Self, DeserializationError> {
632-
<T as DeserializeValue<'frame>>::deserialize(typ, v).map(secrecy::Secret::new)
632+
<T as DeserializeValue<'frame>>::deserialize(typ, v).map(secrecy_08::Secret::new)
633633
}
634634
}
635635

scylla-cql/src/types/serialize/value.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ use uuid::Uuid;
1212
#[cfg(feature = "chrono")]
1313
use chrono::{DateTime, NaiveDate, NaiveTime, Utc};
1414

15-
#[cfg(feature = "secret")]
16-
use secrecy::{ExposeSecret, Secret, Zeroize};
17-
1815
use crate::frame::response::result::{ColumnType, CqlValue};
1916
use crate::frame::types::vint_encode;
2017
use crate::frame::value::{
@@ -205,13 +202,14 @@ impl SerializeValue for time::Time {
205202
<CqlTime as SerializeValue>::serialize(&(*me).into(), typ, writer)?
206203
});
207204
}
208-
#[cfg(feature = "secret")]
209-
impl<V: SerializeValue + Zeroize> SerializeValue for Secret<V> {
205+
#[cfg(feature = "secrecy-08")]
206+
impl<V: SerializeValue + secrecy_08::Zeroize> SerializeValue for secrecy_08::Secret<V> {
210207
fn serialize<'b>(
211208
&self,
212209
typ: &ColumnType,
213210
writer: CellWriter<'b>,
214211
) -> Result<WrittenCellProof<'b>, SerializationError> {
212+
use secrecy_08::ExposeSecret;
215213
V::serialize(self.expose_secret(), typ, writer)
216214
}
217215
}

scylla/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ cloud = [
2424
"dep:url",
2525
"dep:base64",
2626
]
27-
secret = ["scylla-cql/secret"]
27+
secrecy-08 = ["scylla-cql/secrecy-08"]
2828
chrono = ["scylla-cql/chrono"]
2929
time = ["scylla-cql/time"]
3030
num-bigint-03 = ["scylla-cql/num-bigint-03"]
@@ -33,7 +33,7 @@ bigdecimal-04 = ["scylla-cql/bigdecimal-04"]
3333
full-serialization = [
3434
"chrono",
3535
"time",
36-
"secret",
36+
"secrecy-08",
3737
"num-bigint-03",
3838
"num-bigint-04",
3939
"bigdecimal-04",

0 commit comments

Comments
 (0)