File tree Expand file tree Collapse file tree 4 files changed +33
-2
lines changed Expand file tree Collapse file tree 4 files changed +33
-2
lines changed Original file line number Diff line number Diff line change 11[package ]
22name = " scylla-cpp-driver-rust"
33version = " 0.1.0"
4- edition = " 2018 "
4+ edition = " 2021 "
55description = " Wrapper for Scylla's Rust driver, exports functions to be used by C"
66repository = " https://github.com/scylladb/scylla-rust-driver"
77readme = " ./README.md"
Original file line number Diff line number Diff line change @@ -292,7 +292,8 @@ mod tests {
292292 let wrapped_cass_fut = PtrWrapper ( cass_fut) ;
293293 unsafe {
294294 let handle = thread:: spawn ( move || {
295- let PtrWrapper ( cass_fut) = wrapped_cass_fut;
295+ let wrapper = wrapped_cass_fut;
296+ let cass_fut = wrapper. 0 ;
296297 let mut message: * const c_char = std:: ptr:: null ( ) ;
297298 let mut msg_len: size_t = 0 ;
298299 cass_future_error_message ( cass_fut, & mut message, & mut msg_len) ;
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ pub mod inet;
2121pub mod integration_testing;
2222mod logging;
2323pub mod metadata;
24+ pub mod misc;
2425pub mod prepared;
2526pub mod query_error;
2627pub mod query_result;
Original file line number Diff line number Diff line change 1+ use std:: ffi:: { c_char, CStr } ;
2+
3+ // CassConsistency definition.
4+ include ! ( concat!( env!( "OUT_DIR" ) , "/cppdriver_data_query_error.rs" ) ) ;
5+
6+ impl CassConsistency {
7+ pub ( crate ) fn as_cstr ( & self ) -> & ' static CStr {
8+ match * self {
9+ Self :: CASS_CONSISTENCY_UNKNOWN => c"UNKNOWN" ,
10+ Self :: CASS_CONSISTENCY_ANY => c"ANY" ,
11+ Self :: CASS_CONSISTENCY_ONE => c"ONE" ,
12+ Self :: CASS_CONSISTENCY_TWO => c"TWO" ,
13+ Self :: CASS_CONSISTENCY_THREE => c"THREE" ,
14+ Self :: CASS_CONSISTENCY_QUORUM => c"QUORUM" ,
15+ Self :: CASS_CONSISTENCY_ALL => c"ALL" ,
16+ Self :: CASS_CONSISTENCY_LOCAL_QUORUM => c"LOCAL_QUORUM" ,
17+ Self :: CASS_CONSISTENCY_EACH_QUORUM => c"EACH_QUORUM" ,
18+ Self :: CASS_CONSISTENCY_SERIAL => c"SERIAL" ,
19+ Self :: CASS_CONSISTENCY_LOCAL_SERIAL => c"LOCAL_SERIAL" ,
20+ Self :: CASS_CONSISTENCY_LOCAL_ONE => c"LOCAL_ONE" ,
21+ _ => c"" ,
22+ }
23+ }
24+ }
25+
26+ #[ no_mangle]
27+ pub unsafe extern "C" fn cass_consistency_string ( consistency : CassConsistency ) -> * const c_char {
28+ consistency. as_cstr ( ) . as_ptr ( ) as * const c_char
29+ }
You can’t perform that action at this time.
0 commit comments