File tree Expand file tree Collapse file tree 1 file changed +24
-23
lines changed Expand file tree Collapse file tree 1 file changed +24
-23
lines changed Original file line number Diff line number Diff line change @@ -56,29 +56,30 @@ impl Database {
56
56
. list_databases_tables ( & project, & self . data_source_id , & self . database_id , None )
57
57
. await ?;
58
58
59
- let mut table_rows_futures = Vec :: new ( ) ;
60
-
61
- for table in & tables {
62
- let store_ref = & store;
63
- let project_ref = & project;
64
- let data_source_id = & self . data_source_id ;
65
- let database_id = & self . database_id ;
66
- let table_id = table. table_id ( ) . to_string ( ) ;
67
-
68
- let rows_future = async move {
69
- store_ref
70
- . list_database_rows (
71
- project_ref,
72
- data_source_id,
73
- database_id,
74
- & table_id,
75
- None ,
76
- )
77
- . await
78
- } ;
79
-
80
- table_rows_futures. push ( rows_future) ;
81
- }
59
+ let table_rows_futures = tables
60
+ . iter ( )
61
+ . map ( |table| {
62
+ let store_ref = & store;
63
+ let project_ref = & project;
64
+ let data_source_id = & self . data_source_id ;
65
+ let database_id = & self . database_id ;
66
+ let table_id = table. table_id ( ) . to_string ( ) ;
67
+
68
+ let rows_future = async move {
69
+ store_ref
70
+ . list_database_rows (
71
+ project_ref,
72
+ data_source_id,
73
+ database_id,
74
+ & table_id,
75
+ None ,
76
+ )
77
+ . await
78
+ } ;
79
+
80
+ rows_future
81
+ } )
82
+ . collect :: < Vec < _ > > ( ) ;
82
83
83
84
// Now, we concurrently wait for all futures to complete.
84
85
let results: Vec < _ > = futures:: future:: join_all ( table_rows_futures) . await ;
You can’t perform that action at this time.
0 commit comments