pub struct CompilationProgress { /* private fields */ }Expand description
Progress display for cargo compilation.
Parses cargo output lines and renders a compact progress display showing:
- Crate count (X/Y crates)
- Current crate being compiled
- Elapsed time and compilation rate
- Build phase (Compiling, Linking, Testing)
- Warning count accumulator
§Example
ⓘ
use rch_common::ui::{OutputContext, CompilationProgress};
let ctx = OutputContext::detect();
let mut progress = CompilationProgress::new(ctx, "worker1", false);
// Feed cargo output lines
progress.update_from_line(" Compiling serde v1.0.193");
progress.update_from_line(" Compiling serde_json v1.0.108");
progress.update_from_line(" Finished `release` profile [optimized] target(s) in 45.23s");
progress.finish();Implementations§
Source§impl CompilationProgress
impl CompilationProgress
Sourcepub fn new(ctx: OutputContext, worker: impl Into<String>, quiet: bool) -> Self
pub fn new(ctx: OutputContext, worker: impl Into<String>, quiet: bool) -> Self
Create a new compilation progress display.
Sourcepub fn update_from_line(&mut self, line: &str)
pub fn update_from_line(&mut self, line: &str)
Update progress from a raw cargo output line.
Sourcepub fn set_total_crates(&mut self, total: u32)
pub fn set_total_crates(&mut self, total: u32)
Set the total number of crates to compile.
If known ahead of time (e.g., from cargo metadata), this enables percentage display.
Sourcepub fn set_memory_mb(&mut self, mb: u32)
pub fn set_memory_mb(&mut self, mb: u32)
Set memory usage (in MB) for display.
Sourcepub fn finish_error(&mut self, message: &str)
pub fn finish_error(&mut self, message: &str)
Finish with a failure message.
Sourcepub fn phase(&self) -> BuildPhase
pub fn phase(&self) -> BuildPhase
Get the current build phase.
Sourcepub fn crates_compiled(&self) -> u32
pub fn crates_compiled(&self) -> u32
Get the number of crates compiled so far.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for CompilationProgress
impl RefUnwindSafe for CompilationProgress
impl Send for CompilationProgress
impl Sync for CompilationProgress
impl Unpin for CompilationProgress
impl UnsafeUnpin for CompilationProgress
impl UnwindSafe for CompilationProgress
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more