@@ -75,7 +75,7 @@ const LOCAL_VERSION: &str = "SELECT schema_version FROM system.local WHERE key='
7575const OLD_ORPHAN_COUNT_THRESHOLD : usize = 1024 ;
7676const OLD_AGE_ORPHAN_THRESHOLD : std:: time:: Duration = std:: time:: Duration :: from_secs ( 1 ) ;
7777
78- pub struct Connection {
78+ pub ( crate ) struct Connection {
7979 _worker_handle : RemoteHandle < ( ) > ,
8080
8181 connect_address : SocketAddr ,
@@ -210,49 +210,49 @@ struct TaskResponse {
210210 body : Bytes ,
211211}
212212
213- pub struct QueryResponse {
214- pub response : Response ,
215- pub tracing_id : Option < Uuid > ,
216- pub warnings : Vec < String > ,
213+ pub ( crate ) struct QueryResponse {
214+ pub ( crate ) response : Response ,
215+ pub ( crate ) tracing_id : Option < Uuid > ,
216+ pub ( crate ) warnings : Vec < String > ,
217217}
218218
219219// A QueryResponse in which response can not be Response::Error
220- pub struct NonErrorQueryResponse {
221- pub response : NonErrorResponse ,
222- pub tracing_id : Option < Uuid > ,
223- pub warnings : Vec < String > ,
220+ pub ( crate ) struct NonErrorQueryResponse {
221+ pub ( crate ) response : NonErrorResponse ,
222+ pub ( crate ) tracing_id : Option < Uuid > ,
223+ pub ( crate ) warnings : Vec < String > ,
224224}
225225
226226impl QueryResponse {
227- pub fn into_non_error_query_response ( self ) -> Result < NonErrorQueryResponse , QueryError > {
227+ pub ( crate ) fn into_non_error_query_response ( self ) -> Result < NonErrorQueryResponse , QueryError > {
228228 Ok ( NonErrorQueryResponse {
229229 response : self . response . into_non_error_response ( ) ?,
230230 tracing_id : self . tracing_id ,
231231 warnings : self . warnings ,
232232 } )
233233 }
234234
235- pub fn into_query_result ( self ) -> Result < QueryResult , QueryError > {
235+ pub ( crate ) fn into_query_result ( self ) -> Result < QueryResult , QueryError > {
236236 self . into_non_error_query_response ( ) ?. into_query_result ( )
237237 }
238238}
239239
240240impl NonErrorQueryResponse {
241- pub fn as_set_keyspace ( & self ) -> Option < & result:: SetKeyspace > {
241+ pub ( crate ) fn as_set_keyspace ( & self ) -> Option < & result:: SetKeyspace > {
242242 match & self . response {
243243 NonErrorResponse :: Result ( result:: Result :: SetKeyspace ( sk) ) => Some ( sk) ,
244244 _ => None ,
245245 }
246246 }
247247
248- pub fn as_schema_change ( & self ) -> Option < & result:: SchemaChange > {
248+ pub ( crate ) fn as_schema_change ( & self ) -> Option < & result:: SchemaChange > {
249249 match & self . response {
250250 NonErrorResponse :: Result ( result:: Result :: SchemaChange ( sc) ) => Some ( sc) ,
251251 _ => None ,
252252 }
253253 }
254254
255- pub fn into_query_result ( self ) -> Result < QueryResult , QueryError > {
255+ pub ( crate ) fn into_query_result ( self ) -> Result < QueryResult , QueryError > {
256256 let ( rows, paging_state, col_specs, serialized_size) = match self . response {
257257 NonErrorResponse :: Result ( result:: Result :: Rows ( rs) ) => (
258258 Some ( rs. rows ) ,
@@ -407,11 +407,11 @@ impl ConnectionConfig {
407407}
408408
409409// Used to listen for fatal error in connection
410- pub type ErrorReceiver = tokio:: sync:: oneshot:: Receiver < QueryError > ;
410+ pub ( crate ) type ErrorReceiver = tokio:: sync:: oneshot:: Receiver < QueryError > ;
411411
412412impl Connection {
413413 // Returns new connection and ErrorReceiver which can be used to wait for a fatal error
414- pub async fn new (
414+ pub ( crate ) async fn new (
415415 addr : SocketAddr ,
416416 source_port : Option < u16 > ,
417417 config : ConnectionConfig ,
@@ -514,21 +514,24 @@ impl Connection {
514514 Ok ( ( connection, error_receiver) )
515515 }
516516
517- pub async fn startup ( & self , options : HashMap < String , String > ) -> Result < Response , QueryError > {
517+ pub ( crate ) async fn startup (
518+ & self ,
519+ options : HashMap < String , String > ,
520+ ) -> Result < Response , QueryError > {
518521 Ok ( self
519522 . send_request ( & request:: Startup { options } , false , false )
520523 . await ?
521524 . response )
522525 }
523526
524- pub async fn get_options ( & self ) -> Result < Response , QueryError > {
527+ pub ( crate ) async fn get_options ( & self ) -> Result < Response , QueryError > {
525528 Ok ( self
526529 . send_request ( & request:: Options { } , false , false )
527530 . await ?
528531 . response )
529532 }
530533
531- pub async fn prepare ( & self , query : & Query ) -> Result < PreparedStatement , QueryError > {
534+ pub ( crate ) async fn prepare ( & self , query : & Query ) -> Result < PreparedStatement , QueryError > {
532535 let query_response = self
533536 . send_request (
534537 & request:: Prepare {
@@ -564,7 +567,7 @@ impl Connection {
564567 Ok ( prepared_statement)
565568 }
566569
567- async fn reprepare (
570+ pub ( crate ) async fn reprepare (
568571 & self ,
569572 query : impl Into < Query > ,
570573 previous_prepared : & PreparedStatement ,
@@ -582,15 +585,15 @@ impl Connection {
582585 }
583586 }
584587
585- pub async fn authenticate_response (
588+ pub ( crate ) async fn authenticate_response (
586589 & self ,
587590 response : Option < Vec < u8 > > ,
588591 ) -> Result < QueryResponse , QueryError > {
589592 self . send_request ( & request:: AuthResponse { response } , false , false )
590593 . await
591594 }
592595
593- pub async fn query_single_page (
596+ pub ( crate ) async fn query_single_page (
594597 & self ,
595598 query : impl Into < Query > ,
596599 values : impl ValueList ,
@@ -612,7 +615,7 @@ impl Connection {
612615 . await
613616 }
614617
615- pub async fn query_single_page_with_consistency (
618+ pub ( crate ) async fn query_single_page_with_consistency (
616619 & self ,
617620 query : impl Into < Query > ,
618621 values : impl ValueList ,
@@ -625,7 +628,7 @@ impl Connection {
625628 . into_query_result ( )
626629 }
627630
628- pub async fn query (
631+ pub ( crate ) async fn query (
629632 & self ,
630633 query : & Query ,
631634 values : impl ValueList ,
@@ -644,7 +647,7 @@ impl Connection {
644647 . await
645648 }
646649
647- pub async fn query_with_consistency (
650+ pub ( crate ) async fn query_with_consistency (
648651 & self ,
649652 query : & Query ,
650653 values : impl ValueList ,
@@ -670,7 +673,7 @@ impl Connection {
670673 . await
671674 }
672675
673- pub async fn execute_with_consistency (
676+ pub ( crate ) async fn execute_with_consistency (
674677 & self ,
675678 prepared_statement : & PreparedStatement ,
676679 values : impl ValueList ,
@@ -737,7 +740,7 @@ impl Connection {
737740 }
738741
739742 #[ allow( dead_code) ]
740- pub async fn batch (
743+ pub ( crate ) async fn batch (
741744 & self ,
742745 batch : & Batch ,
743746 values : impl BatchValues ,
@@ -753,7 +756,7 @@ impl Connection {
753756 . await
754757 }
755758
756- pub async fn batch_with_consistency (
759+ pub ( crate ) async fn batch_with_consistency (
757760 & self ,
758761 batch : & Batch ,
759762 values : impl BatchValues ,
@@ -803,7 +806,7 @@ impl Connection {
803806 }
804807 }
805808
806- pub async fn use_keyspace (
809+ pub ( crate ) async fn use_keyspace (
807810 & self ,
808811 keyspace_name : & VerifiedKeyspaceName ,
809812 ) -> Result < ( ) , QueryError > {
@@ -856,7 +859,7 @@ impl Connection {
856859 }
857860 }
858861
859- pub async fn fetch_schema_version ( & self ) -> Result < Uuid , QueryError > {
862+ pub ( crate ) async fn fetch_schema_version ( & self ) -> Result < Uuid , QueryError > {
860863 let ( version_id, ) : ( Uuid , ) = self
861864 . query_single_page ( LOCAL_VERSION , & [ ] )
862865 . await ?
@@ -1283,19 +1286,19 @@ impl Connection {
12831286 } )
12841287 }
12851288
1286- pub fn get_shard_info ( & self ) -> & Option < ShardInfo > {
1289+ pub ( crate ) fn get_shard_info ( & self ) -> & Option < ShardInfo > {
12871290 & self . features . shard_info
12881291 }
12891292
1290- pub fn get_shard_aware_port ( & self ) -> Option < u16 > {
1293+ pub ( crate ) fn get_shard_aware_port ( & self ) -> Option < u16 > {
12911294 self . features . shard_aware_port
12921295 }
12931296
12941297 fn set_features ( & mut self , features : ConnectionFeatures ) {
12951298 self . features = features;
12961299 }
12971300
1298- pub fn get_connect_address ( & self ) -> SocketAddr {
1301+ pub ( crate ) fn get_connect_address ( & self ) -> SocketAddr {
12991302 self . connect_address
13001303 }
13011304}
@@ -1339,7 +1342,7 @@ async fn maybe_translated_addr(
13391342 }
13401343}
13411344
1342- pub async fn open_connection (
1345+ pub ( crate ) async fn open_connection (
13431346 endpoint : UntranslatedEndpoint ,
13441347 source_port : Option < u16 > ,
13451348 config : ConnectionConfig ,
@@ -1355,7 +1358,7 @@ pub async fn open_connection(
13551358 . await
13561359}
13571360
1358- pub async fn open_named_connection (
1361+ pub ( crate ) async fn open_named_connection (
13591362 addr : SocketAddr ,
13601363 source_port : Option < u16 > ,
13611364 config : ConnectionConfig ,
@@ -1684,13 +1687,16 @@ impl StreamIdSet {
16841687
16851688/// This type can only hold a valid keyspace name
16861689#[ derive( Debug , Clone , PartialEq , Eq , PartialOrd , Ord ) ]
1687- pub struct VerifiedKeyspaceName {
1690+ pub ( crate ) struct VerifiedKeyspaceName {
16881691 name : Arc < String > ,
1689- pub is_case_sensitive : bool ,
1692+ pub ( crate ) is_case_sensitive : bool ,
16901693}
16911694
16921695impl VerifiedKeyspaceName {
1693- pub fn new ( keyspace_name : String , case_sensitive : bool ) -> Result < Self , BadKeyspaceName > {
1696+ pub ( crate ) fn new (
1697+ keyspace_name : String ,
1698+ case_sensitive : bool ,
1699+ ) -> Result < Self , BadKeyspaceName > {
16941700 Self :: verify_keyspace_name_is_valid ( & keyspace_name) ?;
16951701
16961702 Ok ( VerifiedKeyspaceName {
@@ -1699,7 +1705,7 @@ impl VerifiedKeyspaceName {
16991705 } )
17001706 }
17011707
1702- pub fn as_str ( & self ) -> & str {
1708+ pub ( crate ) fn as_str ( & self ) -> & str {
17031709 self . name . as_str ( )
17041710 }
17051711
0 commit comments