@@ -17,30 +17,33 @@ use crate::client::conn::connector::{Connector, ConnectorMeta};
17
17
use crate :: client:: conn:: Protocol ;
18
18
use crate :: client:: conn:: Transport ;
19
19
20
+ #[ cfg( debug_assertions) ]
21
+ use self :: ids:: CheckoutId ;
20
22
use super :: key:: Token ;
21
23
use super :: Config ;
22
24
use super :: PoolRef ;
23
25
use super :: PoolableConnection ;
24
26
use super :: Pooled ;
25
27
26
28
#[ cfg( debug_assertions) ]
27
- static CHECKOUT_ID : std:: sync:: atomic:: AtomicUsize = std:: sync:: atomic:: AtomicUsize :: new ( 1 ) ;
29
+ mod ids {
30
+ use core:: fmt;
28
31
29
- #[ cfg( debug_assertions) ]
30
- #[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
31
- struct CheckoutId ( usize ) ;
32
+ static CHECKOUT_ID : std:: sync:: atomic:: AtomicUsize = std:: sync:: atomic:: AtomicUsize :: new ( 1 ) ;
32
33
33
- #[ cfg( debug_assertions) ]
34
- impl CheckoutId {
35
- fn new ( ) -> Self {
36
- CheckoutId ( CHECKOUT_ID . fetch_add ( 1 , std:: sync:: atomic:: Ordering :: SeqCst ) )
34
+ #[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
35
+ pub ( super ) struct CheckoutId ( pub ( super ) usize ) ;
36
+
37
+ impl CheckoutId {
38
+ pub ( super ) fn new ( ) -> Self {
39
+ CheckoutId ( CHECKOUT_ID . fetch_add ( 1 , std:: sync:: atomic:: Ordering :: SeqCst ) )
40
+ }
37
41
}
38
- }
39
42
40
- # [ cfg ( debug_assertions ) ]
41
- impl fmt:: Display for CheckoutId {
42
- fn fmt ( & self , f : & mut fmt :: Formatter < ' _ > ) -> fmt :: Result {
43
- write ! ( f , "checkout-{}" , self . 0 )
43
+ impl fmt :: Display for CheckoutId {
44
+ fn fmt ( & self , f : & mut fmt :: Formatter < ' _ > ) -> fmt :: Result {
45
+ write ! ( f , "checkout-{}" , self . 0 )
46
+ }
44
47
}
45
48
}
46
49
0 commit comments