Use `DynNestedProgress` instead of `NestedProgress`, although this also require `<P as NestedProgress>::SubProgress: 'static` which is a breaking change.
Unified · Split
| @@ -62,9 +62,21 @@ pub mod main_worktree { · 61 unmodified lines | |||
| 62 | /// | 62 | /// |
| 63 | /// Note that this is a no-op if the remote was empty, leaving this repository empty as well. This can be validated by checking | 63 | /// Note that this is a no-op if the remote was empty, leaving this repository empty as well. This can be validated by checking |
| 64 | /// if the `head()` of the returned repository is not unborn. | 64 | /// if the `head()` of the returned repository is not unborn. |
| 65 | pub fn main_worktree( | 65 | pub fn main_worktree<P, SubP>( |
| 66 | &mut self, | 66 | &mut self, |
| 67 | mut progress: impl gix_features::progress::NestedProgress, | 67 | mut progress: P, |
| 68 | should_interrupt: &AtomicBool, | ||
| 69 | ) -> Result<(Repository, gix_worktree_state::checkout::Outcome), Error> | ||
| 70 | where | ||
| 71 | P: gix_features::progress::NestedProgress<SubProgress = SubP>, | ||
| 72 | SubP: gix_features::progress::NestedProgress + 'static, | ||
| 73 | { | ||
| 74 | self.main_worktree_inner(&mut progress, should_interrupt) | ||
| 75 | } | ||
| 76 | |||
| 77 | fn main_worktree_inner( | ||
| 78 | &mut self, | ||
| 79 | progress: &mut dyn gix_features::progress::DynNestedProgress, | ||
| 68 | should_interrupt: &AtomicBool, | 80 | should_interrupt: &AtomicBool, |
| 69 | ) -> Result<(Repository, gix_worktree_state::checkout::Outcome), Error> { | 81 | ) -> Result<(Repository, gix_worktree_state::checkout::Outcome), Error> { |
| 70 | let _span = gix_trace::coarse!("gix::clone::PrepareCheckout::main_worktree()"); | 82 | let _span = gix_trace::coarse!("gix::clone::PrepareCheckout::main_worktree()"); |
| @@ -96,8 +108,8 @@ pub mod main_worktree { · 25 unmodified lines | |||
| 96 | .checkout_options(repo, gix_worktree::stack::state::attributes::Source::IdMapping)?; | 108 | .checkout_options(repo, gix_worktree::stack::state::attributes::Source::IdMapping)?; |
| 97 | opts.destination_is_initially_empty = true; | 109 | opts.destination_is_initially_empty = true; |
| 98 | 110 | ||
| 99 | let mut files = progress.add_child_with_id("checkout", ProgressId::CheckoutFiles.into()); | 111 | let mut files = progress.add_child_with_id("checkout".to_string(), ProgressId::CheckoutFiles.into()); |
| 100 | let mut bytes = progress.add_child_with_id("writing", ProgressId::BytesWritten.into()); | 112 | let mut bytes = progress.add_child_with_id("writing".to_string(), ProgressId::BytesWritten.into()); |
| 101 | 113 | ||
| 102 | files.init(Some(index.entries().len()), crate::progress::count("files")); | 114 | files.init(Some(index.entries().len()), crate::progress::count("files")); |
| 103 | bytes.init(None, crate::progress::bytes()); | 115 | bytes.init(None, crate::progress::bytes()); |