pub struct Progress {
pub frames_processed: u64,
pub total_frames: Option<u64>,
pub elapsed: Duration,
}Expand description
Progress information delivered to the caller on each processed frame.
An instance of this struct is passed by reference to the
ProgressCallback registered via
PipelineBuilder::on_progress.
The callback returns true to continue or false to cancel the pipeline.
Fields§
§frames_processed: u64Number of frames processed so far.
total_frames: Option<u64>Total number of frames in the source, or None if the container
does not report a frame count.
elapsed: DurationWall-clock time elapsed since Pipeline::run was called.
Implementations§
Source§impl Progress
impl Progress
Sourcepub fn percent(&self) -> Option<f64>
pub fn percent(&self) -> Option<f64>
Returns the completion percentage in the range 0.0..=100.0, or None
when total_frames is unknown.
§Examples
use ff_pipeline::Progress;
use std::time::Duration;
let p = Progress { frames_processed: 25, total_frames: Some(100), elapsed: Duration::ZERO };
assert_eq!(p.percent(), Some(25.0));
let p = Progress { frames_processed: 5, total_frames: None, elapsed: Duration::ZERO };
assert_eq!(p.percent(), None);Trait Implementations§
Auto Trait Implementations§
impl Freeze for Progress
impl RefUnwindSafe for Progress
impl Send for Progress
impl Sync for Progress
impl Unpin for Progress
impl UnsafeUnpin for Progress
impl UnwindSafe for Progress
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