Struct StatusLine

Source
pub struct StatusLine<D: Display> { /* private fields */ }
Expand description

Wraps arbitrary data and displays it periodically on the screen.

Implementations§

Source§

impl<D: Display + Send + Sync + 'static> StatusLine<D>

Source

pub fn new(data: D) -> StatusLine<D>

Creates a new StatusLine with default options and shows it immediately.

Examples found in repository?
examples/progress-bar.rs (line 27)
21fn main() {
22    let progress = Progress {
23        pos: AtomicUsize::new(0),
24        max: 1000000000,
25    };
26
27    let progress_bar = StatusLine::new(progress);
28
29    // StatusLine can be moved to another thread:
30    thread::spawn(move || {
31        for _ in 0..progress_bar.max {
32            progress_bar.pos.fetch_add(1, Ordering::Relaxed);
33        }
34    })
35    .join()
36    .unwrap();
37}
Source

pub fn with_options(data: D, options: Options) -> StatusLine<D>

Creates a new StatusLine with custom options.

Source§

impl<D: Display> StatusLine<D>

Source

pub fn refresh(&self)

Forces redrawing the status information immediately, without waiting for the next refresh cycle of the background refresh loop.

Source

pub fn set_visible(&self, visible: bool)

Sets the visibility of the status line.

Source

pub fn is_visible(&self) -> bool

Returns true if the status line is currently visible.

Trait Implementations§

Source§

impl<D: Display> Deref for StatusLine<D>

Source§

type Target = D

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<D: Display> Drop for StatusLine<D>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<D> Freeze for StatusLine<D>

§

impl<D> RefUnwindSafe for StatusLine<D>
where D: RefUnwindSafe,

§

impl<D> Send for StatusLine<D>
where D: Sync + Send,

§

impl<D> Sync for StatusLine<D>
where D: Sync + Send,

§

impl<D> Unpin for StatusLine<D>

§

impl<D> UnwindSafe for StatusLine<D>
where D: RefUnwindSafe,

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.