From d55b78853e37eb9a66c01c443ac31ddd28b8b51a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Bary=C5=82a?= Date: Mon, 2 Dec 2024 16:37:17 +0100 Subject: [PATCH] Merge pull request #1133 from muzarski/cpp-rust-decouple-query-rows-result rows_result: implement into_inner behind `cpp_rust_unstable` cfg (cherry picked from commit 62f96b319af3dc6fd0caac04283dbe80e48b5d7e) --- .github/workflows/rust.yml | 2 ++ scylla/Cargo.toml | 5 ++++- scylla/src/lib.rs | 3 +++ scylla/src/transport/query_result.rs | 11 +++++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) 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 diff --git a/scylla/Cargo.toml b/scylla/Cargo.toml index d5d9551e2..6726b76b5 100644 --- a/scylla/Cargo.toml +++ b/scylla/Cargo.toml @@ -98,4 +98,7 @@ harness = false [lints.rust] unnameable_types = "warn" unreachable_pub = "warn" -unexpected_cfgs = { level = "warn", check-cfg = ['cfg(scylla_cloud_tests)'] } +unexpected_cfgs = { level = "warn", check-cfg = [ + 'cfg(scylla_cloud_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`]