11use diesel:: connection:: statement_cache:: { MaybeCached , StatementCallbackReturnType } ;
22use diesel:: QueryResult ;
3- use futures_util:: { future, FutureExt , TryFutureExt } ;
4- use std:: future:: Future ;
3+ use futures_core:: future:: BoxFuture ;
4+ use futures_util:: future:: Either ;
5+ use futures_util:: { FutureExt , TryFutureExt } ;
6+ use std:: future:: { self , Future } ;
57
68pub ( crate ) struct CallbackHelper < F > ( pub ( crate ) F ) ;
79
8- type PrepareFuture < ' a , C , S > = future :: Either <
10+ type PrepareFuture < ' a , C , S > = Either <
911 future:: Ready < QueryResult < ( MaybeCached < ' a , S > , C ) > > ,
10- future :: BoxFuture < ' a , QueryResult < ( MaybeCached < ' a , S > , C ) > > ,
12+ BoxFuture < ' a , QueryResult < ( MaybeCached < ' a , S > , C ) > > ,
1113> ;
1214
1315impl < S , F , C > StatementCallbackReturnType < S , C > for CallbackHelper < F >
@@ -18,22 +20,22 @@ where
1820 type Return < ' a > = PrepareFuture < ' a , C , S > ;
1921
2022 fn from_error < ' a > ( e : diesel:: result:: Error ) -> Self :: Return < ' a > {
21- future :: Either :: Left ( future:: ready ( Err ( e) ) )
23+ Either :: Left ( future:: ready ( Err ( e) ) )
2224 }
2325
2426 fn map_to_no_cache < ' a > ( self ) -> Self :: Return < ' a >
2527 where
2628 Self : ' a ,
2729 {
28- future :: Either :: Right (
30+ Either :: Right (
2931 self . 0
3032 . map_ok ( |( stmt, conn) | ( MaybeCached :: CannotCache ( stmt) , conn) )
3133 . boxed ( ) ,
3234 )
3335 }
3436
3537 fn map_to_cache ( stmt : & mut S , conn : C ) -> Self :: Return < ' _ > {
36- future :: Either :: Left ( future:: ready ( Ok ( ( MaybeCached :: Cached ( stmt) , conn) ) ) )
38+ Either :: Left ( future:: ready ( Ok ( ( MaybeCached :: Cached ( stmt) , conn) ) ) )
3739 }
3840
3941 fn register_cache < ' a > (
4345 where
4446 Self : ' a ,
4547 {
46- future :: Either :: Right (
48+ Either :: Right (
4749 self . 0
4850 . map_ok ( |( stmt, conn) | ( MaybeCached :: Cached ( callback ( stmt) ) , conn) )
4951 . boxed ( ) ,
0 commit comments