@@ -25,7 +25,7 @@ use crate::query::Query;
2525use crate :: routing:: Token ;
2626use crate :: statement:: { Consistency , SerialConsistency } ;
2727use crate :: tracing:: { GetTracingConfig , TracingEvent , TracingInfo } ;
28- use crate :: transport:: cluster:: { Cluster , ClusterData } ;
28+ use crate :: transport:: cluster:: { Cluster , ClusterData , ClusterNeatDebug } ;
2929use crate :: transport:: connection:: {
3030 BatchResult , Connection , ConnectionConfig , VerifiedKeyspaceName ,
3131} ;
@@ -65,6 +65,29 @@ pub struct Session {
6565 auto_await_schema_agreement_timeout : Option < Duration > ,
6666}
6767
68+ /// This implementation deliberately omits some details from Cluster in order
69+ /// to avoid cluttering the print with much information of little usability.
70+ impl std:: fmt:: Debug for Session {
71+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
72+ f. debug_struct ( "Session" )
73+ . field ( "cluster" , & ClusterNeatDebug ( & self . cluster ) )
74+ . field ( "load_balancer" , & self . load_balancer )
75+ . field ( "schema_agreement_interval" , & self . schema_agreement_interval )
76+ . field ( "retry_policy" , & self . retry_policy )
77+ . field (
78+ "speculative_execution_policy" ,
79+ & self . speculative_execution_policy ,
80+ )
81+ . field ( "metrics" , & self . metrics )
82+ . field ( "default_consistency" , & self . default_consistency )
83+ . field (
84+ "auto_await_schema_agreement_timeout" ,
85+ & self . auto_await_schema_agreement_timeout ,
86+ )
87+ . finish ( )
88+ }
89+ }
90+
6891/// Configuration options for [`Session`].
6992/// Can be created manually, but usually it's easier to use
7093/// [SessionBuilder](super::session_builder::SessionBuilder)
0 commit comments