diff options
| author | datdenkikniet <jcdra1@gmail.com> | 2023-04-15 12:21:11 +0200 |
|---|---|---|
| committer | datdenkikniet <jcdra1@gmail.com> | 2023-04-15 12:33:46 +0200 |
| commit | 525703358bf52b74a01d9b0c04680d33621d60cd (patch) | |
| tree | 366346833e91ebfc1704525233cfb68abe3ef600 /xtask/src/argument_parsing.rs | |
| parent | 1ccca03a70b5d11dc03c046041138f73267af22a (diff) | |
Rework command execution structure and make rayon optional (since it's not necessarily faster
due to workspace wide lockfile contention)
Diffstat (limited to 'xtask/src/argument_parsing.rs')
| -rw-r--r-- | xtask/src/argument_parsing.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/xtask/src/argument_parsing.rs b/xtask/src/argument_parsing.rs index 7284fc5..e653f9a 100644 --- a/xtask/src/argument_parsing.rs +++ b/xtask/src/argument_parsing.rs @@ -275,12 +275,22 @@ pub struct PackageOpt { } impl PackageOpt { + #[cfg(not(feature = "rayon"))] pub fn packages(&self) -> impl Iterator<Item = Package> { self.package .map(|p| vec![p]) .unwrap_or(Package::all()) .into_iter() } + + #[cfg(feature = "rayon")] + pub fn packages(&self) -> impl rayon::prelude::ParallelIterator<Item = Package> { + use rayon::prelude::*; + self.package + .map(|p| vec![p]) + .unwrap_or(Package::all()) + .into_par_iter() + } } #[derive(Args, Debug, Clone)] |
