Skip to content

Commit ab081ad

Browse files
committed
api: include public types
The API consists not only from the public functions, but also from the public types. These are needed to use the public API functions in Rust, for integration testing among other usages. Therefore, those types are now re-exported in the `api` module's appropriate submodules.
1 parent 27c642c commit ab081ad

File tree

10 files changed

+58
-11
lines changed

10 files changed

+58
-11
lines changed

scylla-rust-wrapper/src/api.rs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
pub mod execution_profile {
1515
#[rustfmt::skip]
1616
pub use crate::exec_profile::{
17+
CassExecProfile,
1718
cass_execution_profile_free,
1819
cass_execution_profile_new,
1920
cass_execution_profile_set_blacklist_dc_filtering,
@@ -45,6 +46,7 @@ pub mod execution_profile {
4546
pub mod cluster {
4647
#[rustfmt::skip]
4748
pub use crate::cluster::{
49+
CassCluster,
4850
cass_cluster_free,
4951
cass_cluster_new,
5052
cass_cluster_set_application_name,
@@ -139,6 +141,7 @@ pub mod cluster {
139141
pub mod session {
140142
#[rustfmt::skip]
141143
pub use crate::session::{
144+
CassSession,
142145
cass_session_close,
143146
cass_session_connect,
144147
cass_session_connect_keyspace,
@@ -160,6 +163,7 @@ pub mod session {
160163
pub mod schema_meta {
161164
#[rustfmt::skip]
162165
pub use crate::metadata::{
166+
CassSchemaMeta,
163167
cass_schema_meta_free,
164168
// cass_schema_meta_snapshot_version, UNIMPLEMENTED
165169
// cass_schema_meta_version, UNIMPLEMENTED
@@ -171,6 +175,7 @@ pub mod schema_meta {
171175
pub mod keyspace_meta {
172176
#[rustfmt::skip]
173177
pub use crate::metadata::{
178+
CassKeyspaceMeta,
174179
// cass_keyspace_meta_aggregate_by_name, UNIMPLEMENTED
175180
// cass_keyspace_meta_aggregate_by_name_n, UNIMPLEMENTED
176181
// cass_keyspace_meta_field_by_name, UNIMPLEMENTED
@@ -191,6 +196,7 @@ pub mod keyspace_meta {
191196
pub mod table_meta {
192197
#[rustfmt::skip]
193198
pub use crate::metadata::{
199+
CassTableMeta,
194200
cass_table_meta_clustering_key_count,
195201
cass_table_meta_clustering_key,
196202
// cass_table_meta_clustering_key_order, UNIMPLEMENTED
@@ -218,6 +224,7 @@ pub mod table_meta {
218224
pub mod materialized_view_meta {
219225
#[rustfmt::skip]
220226
pub use crate::metadata::{
227+
CassMaterializedViewMeta,
221228
cass_materialized_view_meta_base_table,
222229
cass_materialized_view_meta_column,
223230
cass_materialized_view_meta_column_by_name,
@@ -237,6 +244,7 @@ pub mod materialized_view_meta {
237244
pub mod column_meta {
238245
#[rustfmt::skip]
239246
pub use crate::metadata::{
247+
CassColumnMeta,
240248
cass_column_meta_data_type,
241249
// cass_column_meta_field_by_name, UNIMPLEMENTED
242250
// cass_column_meta_field_by_name_n, UNIMPLEMENTED
@@ -249,6 +257,7 @@ pub mod index_meta {
249257
#[expect(unused_imports)]
250258
#[rustfmt::skip]
251259
pub use crate::metadata::{
260+
// CassIndexMeta,
252261
// cass_index_meta_name, UNIMPLEMENTED
253262
// cass_index_meta_field_by_name, UNIMPLEMENTED
254263
// cass_index_meta_field_by_name_n, UNIMPLEMENTED
@@ -262,6 +271,7 @@ pub mod function_meta {
262271
#[expect(unused_imports)]
263272
#[rustfmt::skip]
264273
pub use crate::metadata::{
274+
// CassFunctionMeta,
265275
// cass_function_meta_argument_count, UNIMPLEMENTED
266276
// cass_function_meta_argument, UNIMPLEMENTED
267277
// cass_function_meta_argument_type_by_name, UNIMPLEMENTED
@@ -281,6 +291,7 @@ pub mod aggregate_meta {
281291
#[expect(unused_imports)]
282292
#[rustfmt::skip]
283293
pub use crate::metadata::{
294+
// CassAggregateMeta,
284295
// cass_aggregate_meta_argument, UNIMPLEMENTED
285296
// cass_aggregate_meta_argument_count, UNIMPLEMENTED
286297
// cass_aggregate_meta_argument_type, UNIMPLEMENTED
@@ -299,6 +310,7 @@ pub mod aggregate_meta {
299310
pub mod ssl {
300311
#[rustfmt::skip]
301312
pub use crate::ssl::{
313+
CassSsl,
302314
cass_ssl_add_trusted_cert,
303315
cass_ssl_add_trusted_cert_n,
304316
cass_ssl_free,
@@ -316,6 +328,7 @@ pub mod authenticator {
316328
#[expect(unused_imports)]
317329
#[rustfmt::skip]
318330
pub use crate::{
331+
// CassAuthenticator,
319332
// cass_authenticator_address, UNIMPLEMENTED
320333
// cass_authenticator_hostname, UNIMPLEMENTED
321334
// cass_authenticator_class_name, UNIMPLEMENTED
@@ -331,6 +344,8 @@ pub mod authenticator {
331344
pub mod future {
332345
#[rustfmt::skip]
333346
pub use crate::future::{
347+
CassFuture,
348+
CassFutureCallback,
334349
cass_future_coordinator,
335350
cass_future_error_code,
336351
cass_future_error_message,
@@ -350,11 +365,17 @@ pub mod future {
350365
cass_future_custom_payload_item, // FIXME: Should be unimplemented!
351366
cass_future_custom_payload_item_count, // FIXME: Should be unimplemented!
352367
};
368+
369+
#[rustfmt::skip]
370+
pub use crate::query_result::{
371+
CassNode, // `cass_future_coordinator()` returns a `CassNode`.
372+
};
353373
}
354374

355375
pub mod statement {
356376
#[rustfmt::skip]
357377
pub use crate::statement::{
378+
CassStatement,
358379
cass_statement_bind_bool,
359380
cass_statement_bind_bool_by_name,
360381
cass_statement_bind_bool_by_name_n,
@@ -448,6 +469,7 @@ pub mod statement {
448469
pub mod prepared {
449470
#[rustfmt::skip]
450471
pub use crate::prepared::{
472+
CassPrepared,
451473
cass_prepared_bind,
452474
cass_prepared_free,
453475
cass_prepared_parameter_data_type,
@@ -460,6 +482,8 @@ pub mod prepared {
460482
pub mod batch {
461483
#[rustfmt::skip]
462484
pub use crate::batch::{
485+
CassBatch,
486+
CassBatchType,
463487
cass_batch_add_statement,
464488
cass_batch_free,
465489
cass_batch_new,
@@ -485,6 +509,7 @@ pub mod batch {
485509
pub mod data_type {
486510
#[rustfmt::skip]
487511
pub use crate::cass_types::{
512+
CassDataType,
488513
cass_data_sub_type_count,
489514
cass_data_type_add_sub_type,
490515
cass_data_type_add_sub_type_by_name,
@@ -519,6 +544,7 @@ pub mod data_type {
519544
pub mod collection {
520545
#[rustfmt::skip]
521546
pub use crate::collection::{
547+
CassCollection,
522548
cass_collection_append_bool,
523549
cass_collection_append_bytes,
524550
cass_collection_append_collection,
@@ -549,6 +575,7 @@ pub mod collection {
549575
pub mod tuple {
550576
#[rustfmt::skip]
551577
pub use crate::tuple::{
578+
CassTuple,
552579
cass_tuple_data_type,
553580
cass_tuple_free,
554581
cass_tuple_new,
@@ -580,6 +607,7 @@ pub mod tuple {
580607
pub mod user_type {
581608
#[rustfmt::skip]
582609
pub use crate::user_type::{
610+
CassUserType,
583611
cass_user_type_data_type,
584612
cass_user_type_free,
585613
cass_user_type_new_from_data_type,
@@ -648,6 +676,7 @@ pub mod user_type {
648676
pub mod result {
649677
#[rustfmt::skip]
650678
pub use crate::query_result::{
679+
CassResult,
651680
cass_result_column_count,
652681
cass_result_column_data_type,
653682
cass_result_column_name,
@@ -663,6 +692,9 @@ pub mod result {
663692
pub mod error {
664693
#[rustfmt::skip]
665694
pub use crate::execution_error::{
695+
CassError,
696+
CassErrorResult,
697+
CassErrorSource,
666698
cass_error_num_arg_types,
667699
cass_error_result_arg_type,
668700
cass_error_result_code,
@@ -687,6 +719,7 @@ pub mod error {
687719
pub mod iterator {
688720
#[rustfmt::skip]
689721
pub use crate::iterator::{
722+
CassIterator,
690723
cass_iterator_fields_from_user_type,
691724
cass_iterator_free,
692725
cass_iterator_from_collection,
@@ -736,6 +769,7 @@ pub mod iterator {
736769
pub mod row {
737770
#[rustfmt::skip]
738771
pub use crate::query_result::{
772+
CassRow,
739773
cass_row_get_column,
740774
cass_row_get_column_by_name,
741775
cass_row_get_column_by_name_n,
@@ -745,6 +779,8 @@ pub mod row {
745779
pub mod value {
746780
#[rustfmt::skip]
747781
pub use crate::query_result::{
782+
CassValue,
783+
CassValueType,
748784
cass_value_data_type,
749785
cass_value_get_bool,
750786
cass_value_get_bytes,
@@ -774,6 +810,7 @@ pub mod value {
774810
pub mod uuid_gen {
775811
#[rustfmt::skip]
776812
pub use crate::uuid::{
813+
CassUuidGen,
777814
cass_uuid_gen_free,
778815
cass_uuid_gen_from_time,
779816
cass_uuid_gen_new,
@@ -799,6 +836,7 @@ pub mod uuid {
799836
pub mod timestamp_gen {
800837
#[rustfmt::skip]
801838
pub use crate::timestamp_generator::{
839+
CassTimestampGen,
802840
cass_timestamp_gen_free,
803841
cass_timestamp_gen_monotonic_new,
804842
cass_timestamp_gen_monotonic_new_with_settings,
@@ -809,6 +847,7 @@ pub mod timestamp_gen {
809847
pub mod retry_policy {
810848
#[rustfmt::skip]
811849
pub use crate::retry_policy::{
850+
CassRetryPolicy,
812851
cass_retry_policy_default_new,
813852
cass_retry_policy_downgrading_consistency_new,
814853
cass_retry_policy_fallthrough_new,
@@ -826,27 +865,31 @@ pub mod custom_payload {
826865
// cass_custom_payload_set_n, UNIMPLEMENTED
827866
#[rustfmt::skip]
828867
pub use crate::cluster::{
868+
CassCustomPayload, // FIXME: Should be unimplemented!
829869
cass_custom_payload_new, // FIXME: Should be unimplemented!
830870
};
831871
}
832872

833873
pub mod consistency {
834874
#[rustfmt::skip]
835875
pub use crate::misc::{
876+
CassConsistency,
836877
cass_consistency_string
837878
};
838879
}
839880

840881
pub mod write_type {
841882
#[rustfmt::skip]
842883
pub use crate::misc::{
884+
CassWriteType,
843885
cass_write_type_string
844886
};
845887
}
846888

847889
pub mod log {
848890
#[rustfmt::skip]
849891
pub use crate::logging::{
892+
CassLogCallback,
850893
cass_log_cleanup,
851894
cass_log_get_callback_and_data,
852895
cass_log_level_string,
@@ -859,6 +902,7 @@ pub mod log {
859902
pub mod inet {
860903
#[rustfmt::skip]
861904
pub use crate::inet::{
905+
CassInet,
862906
cass_inet_from_string,
863907
cass_inet_from_string_n,
864908
cass_inet_init_v4,

scylla-rust-wrapper/src/batch.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ use crate::argconv::{
33
FFI, FromBox,
44
};
55
use crate::cass_error::CassError;
6-
use crate::cass_types::{CassBatchType, CassConsistency, make_batch_type};
6+
pub use crate::cass_types::CassBatchType;
7+
use crate::cass_types::{CassConsistency, make_batch_type};
78
use crate::config_value::MaybeUnsetConfig;
89
use crate::exec_profile::PerStatementExecProfile;
910
use crate::retry_policy::CassRetryPolicy;

scylla-rust-wrapper/src/cass_error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use scylla::errors::*;
22

33
// Re-export error types.
4-
pub(crate) use crate::cass_error_types::{CassError, CassErrorSource};
4+
pub use crate::cass_error_types::{CassError, CassErrorSource};
55
use crate::execution_error::CassErrorResult;
66
use crate::statement::UnknownNamedParameterError;
77

scylla-rust-wrapper/src/cass_types.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ use std::cell::UnsafeCell;
88
use std::os::raw::c_char;
99
use std::sync::Arc;
1010

11-
pub(crate) use crate::cass_batch_types::CassBatchType;
12-
pub(crate) use crate::cass_consistency_types::CassConsistency;
13-
pub(crate) use crate::cass_data_types::CassValueType;
11+
pub use crate::cass_batch_types::CassBatchType;
12+
pub use crate::cass_consistency_types::CassConsistency;
13+
pub use crate::cass_data_types::CassValueType;
1414

1515
#[derive(Clone, Debug)]
1616
#[cfg_attr(test, derive(PartialEq, Eq))]

scylla-rust-wrapper/src/execution_error.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::argconv::*;
22
use crate::cass_error::*;
3+
pub use crate::cass_error::{CassError, CassErrorSource};
34
use crate::cass_error_types::CassWriteType;
45
use crate::cass_types::CassConsistency;
56
use crate::types::*;

scylla-rust-wrapper/src/inet.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::os::raw::c_char;
99
use std::slice::from_raw_parts;
1010
use std::str::FromStr;
1111

12-
pub(crate) use crate::cass_inet_types::CassInet;
12+
pub use crate::cass_inet_types::CassInet;
1313

1414
#[repr(u8)] // address_length field in CassInet is cass_uint8_t
1515
#[allow(non_camel_case_types)]

scylla-rust-wrapper/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ macro_rules! include_bindgen_generated {
5454
}
5555

5656
/// All numeric types are defined here.
57-
pub(crate) mod types {
57+
pub mod types {
5858
#![allow(non_camel_case_types)]
5959
// for `cass_false` and `cass_true` globals.
6060
#![allow(non_upper_case_globals)]

scylla-rust-wrapper/src/misc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::ffi::{CStr, c_char};
22

3-
use crate::{cass_error_types::CassWriteType, cass_types::CassConsistency};
3+
pub use crate::{cass_error_types::CassWriteType, cass_types::CassConsistency};
44

55
impl CassConsistency {
66
pub(crate) fn as_cstr(&self) -> &'static CStr {

scylla-rust-wrapper/src/query_result.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
use crate::argconv::*;
22
use crate::cass_error::{CassError, ToCassError};
3+
pub use crate::cass_types::CassValueType;
34
use crate::cass_types::{
4-
CassColumnSpec, CassDataType, CassDataTypeInner, CassValueType, MapDataType,
5-
cass_data_type_type, get_column_type,
5+
CassColumnSpec, CassDataType, CassDataTypeInner, MapDataType, cass_data_type_type,
6+
get_column_type,
67
};
78
use crate::execution_error::CassErrorResult;
89
use crate::inet::CassInet;

scylla-rust-wrapper/src/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use std::sync::Arc;
3232
use std::time::Duration;
3333
use tokio::sync::RwLock;
3434

35-
pub(crate) struct CassSessionInner {
35+
pub struct CassSessionInner {
3636
session: Session,
3737
exec_profile_map: HashMap<ExecProfileName, ExecutionProfileHandle>,
3838
client_id: uuid::Uuid,

0 commit comments

Comments
 (0)