Skip to main content

ProgressRenderer

Trait ProgressRenderer 

Source
pub trait ProgressRenderer: Send + Sync {
    // Required methods
    fn on_start(&self, value: usize, max: usize);
    fn on_update(&self, value: usize, max: usize);
    fn on_finish(&self);
    fn on_notify(&self, msg: String);
    fn set_label(&self, msg: &str);
}
Expand description

Defines how a progress bar should be rendered

Required Methods§

Source

fn on_start(&self, value: usize, max: usize)

Called when the crate::ProgressBar which holds the instance of Self is spawned

Source

fn on_update(&self, value: usize, max: usize)

Called when the crate::ProgressBar which holds the instance of Self is updated

Source

fn on_finish(&self)

Called when the crate::ProgressBar which holds the instance of Self is dropped

§Notes

Self::on_update() is NOT automatically called before finish, if you would like to update before the renderer is dropped, you can do so when defining this function

Source

fn on_notify(&self, msg: String)

Generic notification. Can be sent from anything with access to the crate::ProgressBar that holds the instance of Self

This function is not called internally by anything, its meant for other libraries to call when they want to notify your renderer of some message. If you do not care, you can ignore this function

Source

fn set_label(&self, msg: &str)

Sets the label of Self. Can be sent from anything with access to the crate::ProgressBar that holds the instance of Self

This function is not called internally by anything, its meant for other libraries to call when they want to label your progress bar. If you do not care, you can ignore this function

Implementors§