morristai commented on code in PR #3599:
URL: 
https://github.com/apache/incubator-opendal/pull/3599#discussion_r1402938667


##########
core/src/types/list.rs:
##########
@@ -45,10 +44,20 @@ pub struct Lister {
     /// required_metakey is the metakey required by users.
     required_metakey: FlagSet<Metakey>,
 
-    stating: Option<StatFuture>,
+    /// listing is used to indicate whether we are listing entries or stat 
entries.
+    listing: bool,
+    /// task_queue is used to store tasks that are run in concurrent.
+    task_queue: VecDeque<StatTask>,
     errored: bool,
 }
 
+enum StatTask {
+    /// Handle is used to store the join handle of spawned task.
+    Handle(JoinHandle<(String, Result<RpStat>)>),
+    /// KnownEntry is used to store the entry that already contains the 
required metakey.
+    KnownEntry(Box<Option<(String, Metadata)>>),

Review Comment:
   Here the warning generated by `cargo clippy`:
   ```rust
   warning: large size difference between variants
     --> core/src/types/list.rs:52:1
      |
   52 | / enum StatTask {
   53 | |     /// Handle is used to store the join handle of spawned task.
   54 | |     Handle(JoinHandle<(String, Result<RpStat>)>),
      | |     -------------------------------------------- the second-largest 
variant contains at least 0 bytes
   55 | |     /// KnownEntry is used to store the entry that already contains 
the required metakey.
   56 | |     KnownEntry(Option<(String, Metadata)>),
      | |     -------------------------------------- the largest variant 
contains at least 264 bytes
   57 | | }
      | |_^ the entire enum is at least 0 bytes
      |
      = help: for further information visit 
https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant
      = note: `#[warn(clippy::large_enum_variant)]` on by default
   help: consider boxing the large fields to reduce the total size of the enum
      |
   56 |     KnownEntry(Box<Option<(String, Metadata)>>),
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   ````
   
   I don't know if moving the data that the enum holds to the heap will 
optimize the compiler a bit more?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to