11use diesel:: connection:: statement_cache:: { MaybeCached , StatementCallbackReturnType } ;
22use diesel:: QueryResult ;
33use futures_core:: future:: BoxFuture ;
4- use futures_util:: { future, FutureExt , TryFutureExt } ;
5- use std:: future:: Future ;
4+ use futures_util:: future:: Either ;
5+ use futures_util:: { FutureExt , TryFutureExt } ;
6+ use std:: future:: { self , Future } ;
67
78pub ( crate ) struct CallbackHelper < F > ( pub ( crate ) F ) ;
89
9- type PrepareFuture < ' a , C , S > = future :: Either <
10+ type PrepareFuture < ' a , C , S > = Either <
1011 future:: Ready < QueryResult < ( MaybeCached < ' a , S > , C ) > > ,
1112 BoxFuture < ' a , QueryResult < ( MaybeCached < ' a , S > , C ) > > ,
1213> ;
@@ -19,22 +20,22 @@ where
1920 type Return < ' a > = PrepareFuture < ' a , C , S > ;
2021
2122 fn from_error < ' a > ( e : diesel:: result:: Error ) -> Self :: Return < ' a > {
22- future :: Either :: Left ( future:: ready ( Err ( e) ) )
23+ Either :: Left ( future:: ready ( Err ( e) ) )
2324 }
2425
2526 fn map_to_no_cache < ' a > ( self ) -> Self :: Return < ' a >
2627 where
2728 Self : ' a ,
2829 {
29- future :: Either :: Right (
30+ Either :: Right (
3031 self . 0
3132 . map_ok ( |( stmt, conn) | ( MaybeCached :: CannotCache ( stmt) , conn) )
3233 . boxed ( ) ,
3334 )
3435 }
3536
3637 fn map_to_cache ( stmt : & mut S , conn : C ) -> Self :: Return < ' _ > {
37- future :: Either :: Left ( future:: ready ( Ok ( ( MaybeCached :: Cached ( stmt) , conn) ) ) )
38+ Either :: Left ( future:: ready ( Ok ( ( MaybeCached :: Cached ( stmt) , conn) ) ) )
3839 }
3940
4041 fn register_cache < ' a > (
4445 where
4546 Self : ' a ,
4647 {
47- future :: Either :: Right (
48+ Either :: Right (
4849 self . 0
4950 . map_ok ( |( stmt, conn) | ( MaybeCached :: Cached ( callback ( stmt) ) , conn) )
5051 . boxed ( ) ,
0 commit comments