Skip to main content

ProgressHandler

Struct ProgressHandler 

Source
pub struct ProgressHandler { /* private fields */ }
Expand description

EventHandler that drives an indicatif ProgressBar on each node completion.

Pass as user_handler to task.schedule(). The TaskGatheringHandler chains on_close/on_timeout to us — no core changes needed.

ProgressBar is internally Arc’d, so updates from the poll thread are immediately visible to the steady-tick render thread.

Implementations§

Source§

impl ProgressHandler

Source

pub fn new(state: ProgressState, bar: ProgressBar) -> Self

Trait Implementations§

Source§

impl EventHandler for ProgressHandler

Source§

fn on_close(&mut self, _node: &str, rc: i32)

Called when a connection to a node is closed.
Source§

fn on_timeout(&mut self, _node: &str)

Called when a node operation times out.
Source§

fn on_start(&mut self, worker: &dyn Worker)

Called when the worker starts.
Source§

fn on_read(&mut self, node: &str, fd: i32, msg: &[u8])

Called when data is available for reading from a node.
Source§

fn on_error(&mut self, node: &str, error: &WorkerError)

Called when an error occurs for a node.
Source§

fn take_buffers( &mut self, ) -> (HashMap<String, Vec<Vec<u8>>>, HashMap<String, Vec<Vec<u8>>>, HashSet<String>)

Extract buffered stdout/stderr data from this handler. Returns (stdout, stderr, timeouts) where stdout/stderr are node -> Vec<chunks>. Default returns empty maps. Used by Task to collect results after execution.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.