@@ -16,6 +16,7 @@ use scylla_cql::frame::response::result::{PreparedMetadata, ResultMetadata};
1616use scylla_cql:: types:: serialize:: batch:: BatchValues ;
1717use scylla_cql:: types:: serialize:: row:: SerializeRow ;
1818use std:: collections:: hash_map:: RandomState ;
19+ use std:: fmt;
1920use std:: hash:: BuildHasher ;
2021use std:: sync:: Arc ;
2122
@@ -39,7 +40,6 @@ struct RawPreparedStatementData {
3940}
4041
4142/// Provides auto caching while executing queries
42- #[ derive( Debug ) ]
4343pub struct GenericCachingSession < DeserializationApi , S = RandomState >
4444where
4545 S : Clone + BuildHasher ,
5353 cache : DashMap < String , RawPreparedStatementData , S > ,
5454}
5555
56+ impl < DeserializationApi , S > fmt:: Debug for GenericCachingSession < DeserializationApi , S >
57+ where
58+ S : Clone + BuildHasher ,
59+ DeserializationApi : DeserializationApiKind ,
60+ {
61+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
62+ f. debug_struct ( "GenericCachingSession" )
63+ . field ( "session" , & self . session )
64+ . field ( "max_capacity" , & self . max_capacity )
65+ . field ( "cache" , & self . cache )
66+ . finish ( )
67+ }
68+ }
69+
5670pub type CachingSession < S = RandomState > = GenericCachingSession < CurrentDeserializationApi , S > ;
5771
5872#[ deprecated(
@@ -335,6 +349,8 @@ mod tests {
335349 use crate :: transport:: partitioner:: PartitionerName ;
336350 use crate :: transport:: session:: Session ;
337351 use crate :: utils:: test_utils:: unique_keyspace_name;
352+ #[ allow( deprecated) ]
353+ use crate :: LegacyCachingSession ;
338354 use crate :: {
339355 batch:: { Batch , BatchStatement } ,
340356 prepared_statement:: PreparedStatement ,
@@ -766,4 +782,12 @@ mod tests {
766782 verify_partitioner ( ) . await ;
767783 verify_partitioner ( ) . await ;
768784 }
785+
786+ // NOTE: intentionally no `#[test]`: this is a compile-time test
787+ fn _caching_session_impls_debug ( ) {
788+ fn assert_debug < T : std:: fmt:: Debug > ( ) { }
789+ assert_debug :: < CachingSession > ( ) ;
790+ #[ allow( deprecated) ]
791+ assert_debug :: < LegacyCachingSession > ( ) ;
792+ }
769793}
0 commit comments