From 758105806fb11a493bd0dc18e088bbe1cc6ab9a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Uzarski?= Date: Fri, 29 Nov 2024 14:44:28 +0100 Subject: [PATCH 1/2] rows_result: implement into_inner behind cpp_rust_unstable cfg This is convenience introduced only for cpp-rust-driver purposes. We will use DeserializedMetadataAndRawRows directly to implement lazy deserialization in cpp-rust-driver --- scylla/Cargo.toml | 6 +++++- scylla/src/lib.rs | 3 +++ scylla/src/transport/query_result.rs | 11 +++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/scylla/Cargo.toml b/scylla/Cargo.toml index 390a99501..6f4ba4907 100644 --- a/scylla/Cargo.toml +++ b/scylla/Cargo.toml @@ -98,4 +98,8 @@ harness = false [lints.rust] unnameable_types = "warn" unreachable_pub = "warn" -unexpected_cfgs = { level = "warn", check-cfg = ['cfg(scylla_cloud_tests)', 'cfg(cassandra_tests)'] } +unexpected_cfgs = { level = "warn", check-cfg = [ + 'cfg(scylla_cloud_tests)', + 'cfg(cassandra_tests)', + 'cfg(cpp_rust_unstable)', +] } diff --git a/scylla/src/lib.rs b/scylla/src/lib.rs index f03edf7a9..6724a65d9 100644 --- a/scylla/src/lib.rs +++ b/scylla/src/lib.rs @@ -118,6 +118,9 @@ pub mod frame { pub(crate) use scylla_cql::frame::response::*; pub mod result { + #[cfg(cpp_rust_unstable)] + pub use scylla_cql::frame::response::result::DeserializedMetadataAndRawRows; + pub(crate) use scylla_cql::frame::response::result::*; pub use scylla_cql::frame::response::result::{ ColumnSpec, ColumnType, CqlValue, PartitionKeyIndex, Row, TableSpec, diff --git a/scylla/src/transport/query_result.rs b/scylla/src/transport/query_result.rs index 114a433f2..b76ec28e5 100644 --- a/scylla/src/transport/query_result.rs +++ b/scylla/src/transport/query_result.rs @@ -433,6 +433,17 @@ impl QueryRowsResult { Err(RowsError::TypeCheckFailed(err)) => Err(SingleRowError::TypeCheckFailed(err)), } } + + #[cfg(cpp_rust_unstable)] + pub fn into_inner(self) -> (DeserializedMetadataAndRawRows, Option, Vec) { + let Self { + raw_rows_with_metadata, + tracing_id, + warnings, + } = self; + + (raw_rows_with_metadata, tracing_id, warnings) + } } /// An error returned by [`QueryResult::into_rows_result`] From ead6ef03366b566eec2498dd3fc8268a7fbb66b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Uzarski?= Date: Fri, 29 Nov 2024 15:16:36 +0100 Subject: [PATCH 2/2] ci: clippy check with cpp_rust_unstable cfg --- .github/workflows/rust.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c06c1c495..2d4a9e92d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -40,6 +40,8 @@ jobs: run: cargo clippy --verbose --all-targets - name: Clippy check with all features run: cargo clippy --verbose --all-targets --all-features + - name: Cargo check with cpp_rust_unstable cfg + run: RUSTFLAGS="--cfg cpp_rust_unstable" cargo clippy --verbose --all-targets --all-features - name: Cargo check without features run: cargo check --all-targets --manifest-path "scylla/Cargo.toml" --features "" - name: Cargo check with all serialization features