NcProgBar

Type Alias NcProgBar 

Source
pub type NcProgBar = ncprogbar;
Expand description

Progress bars. They proceed linearly in any of four directions.

The entirety of the plane will be used – any border should be provided by the caller on another plane.

The plane will not be erased; text preloaded into the plane will be consumed by the progress indicator.

The bar is redrawn for each provided progress report (a double between 0 and 1), and can regress with lower values.

The procession will take place along the longer dimension at the time of each redraw, with the horizontal length scaled by 2 for purposes of comparison. I.e. for a plane of 20 rows and 50 columns, the progress will be to the right (50 > 40), or left with NcProgBarOptions::RETROGRADE.

type in C: ncprogbar (struct)

Aliased Type§

pub struct NcProgBar { /* private fields */ }

Implementations§

Source§

impl NcProgBar

§NcProgBar Methods

Source

pub fn new<'a>(plane: &mut NcPlane) -> &'a mut Self

New NcProgBar.

Takes ownership of the plane, which will be destroyed by destroy(). The progress bar is initially at 0%.

Source

pub fn with_options<'a>( plane: &mut NcPlane, options: &NcProgBarOptions, ) -> &'a mut Self

New NcProgBar. Expects an NcProgBarOptions struct.

C style function: ncprogbar_create().

Source

pub fn destroy(&mut self)

Destroy the progress bar and its underlying ncplane.

C style function: ncprogbar_destroy().

Source

pub fn plane(&mut self) -> &mut NcPlane

Return a reference to the ncprogbar’s underlying ncplane.

C style function: ncprogbar_plane().

Source

pub fn progress(&self) -> f64

Get the progress bar’s completion, an f64 on [0, 1].

C style function: ncprogbar_progress().

Source

pub fn set_progress(&mut self, progress: f64) -> NcResult<()>

Sets the progress bar’s completion, an 0 <= f64 <= 1.

Returns NCRESULT_ERR if progress is < 0 || > 1.

C style function: ncprogbar_set_progress().