pub struct Live<W: Write> { /* private fields */ }Expand description
An in-place updating display over a renderable. Mirrors rich.live.Live
(manual-refresh subset). Output is written to a generic sink W, so it can
target stdout or, in tests, a byte buffer.
Implementations§
Source§impl<W: Write> Live<W>
impl<W: Write> Live<W>
Sourcepub fn new(renderable: Box<dyn Renderable>, console: Console, writer: W) -> Self
pub fn new(renderable: Box<dyn Renderable>, console: Console, writer: W) -> Self
Create a live display for renderable, rendering with console and
writing control/output bytes to writer.
Sourcepub fn update(&mut self, renderable: Box<dyn Renderable>)
pub fn update(&mut self, renderable: Box<dyn Renderable>)
Swap in a new renderable and redraw in place.
Sourcepub fn refresh(&mut self)
pub fn refresh(&mut self)
Redraw the current renderable in place (reposition over the last frame, then render).
Sourcepub fn into_writer(self) -> W
pub fn into_writer(self) -> W
Consume the display, returning its output sink.
Source§impl<W: Write + Send + 'static> Live<W>
impl<W: Write + Send + 'static> Live<W>
Sourcepub fn spawn(
renderable: Box<dyn Renderable + Send>,
console: Console,
writer: W,
refresh_per_second: f64,
) -> AutoLive<W>
pub fn spawn( renderable: Box<dyn Renderable + Send>, console: Console, writer: W, refresh_per_second: f64, ) -> AutoLive<W>
Start an auto-refreshing live display on a background thread: it draws the
first frame, then redraws every 1/refresh_per_second seconds (and
immediately on each AutoLive::update). Mirrors upstream’s
auto_refresh/refresh_per_second. The renderable, console, and
writer are moved into the thread, so all three must be Send.