Skip to main content

AutoLive

Struct AutoLive 

Source
pub struct AutoLive<W: Write + Send + 'static> { /* private fields */ }
Expand description

A handle to an auto-refreshing Live running on a background thread. Dropping the handle (or calling stop) finalizes the display.

Implementations§

Source§

impl<W: Write + Send + 'static> AutoLive<W>

Source

pub fn update(&self, renderable: Box<dyn Renderable + Send>)

Swap in a new renderable; the thread redraws it promptly.

Source

pub fn refresh(&self)

Ask the thread to redraw the current renderable now.

Source

pub fn print(&self, renderable: Box<dyn Renderable + Send>)

Print renderable above the display (Live::print), on the thread.

Source

pub fn print_str(&self, content: impl Into<String>)

Print a string as console markup above the display (Live::print_str), on the thread.

Source

pub fn log( &self, objects: &[LogObject<'_>], options: &LogOptions<'_>, ) -> Result<()>

Log above the display (Live::log), on the thread.

Source

pub fn handle(&self) -> LiveHandle<W>

A cloneable handle to the thread, for proxies and prints from other threads.

Source

pub fn stdout(&self) -> FileProxy<LiveHandle<W>, Stdout> ⓘ

A writer standing in for stdout while the display runs (upstream’s sys.stdout FileProxy); see Live::stdout.

Source

pub fn stderr(&self) -> FileProxy<LiveHandle<W>, Stderr> ⓘ

stdout for stderr.

Source

pub fn file_proxy<F: Write>( &self, stream: ProxyStream, file: F, ) -> FileProxy<LiveHandle<W>, F> ⓘ

A proxy for stream over any file, which receives the writes when the display is not redirecting.

Source

pub fn refresh_wait(&self)

Redraw now and wait until the frame is written, as upstream’s Live.refresh() renders in the caller’s thread. A renderable that reads shared state then shows the state as of this call.

Source

pub fn stop(self) -> W

Commit the final frame, join the thread, and return the output sink.

If a render panicked on the refresh thread, the cursor has already been shown again and the failure is swallowed (the panic hook reported it when it happened); use try_stop to observe it.

Source

pub fn try_stop(self) -> Result<W, LivePanic<W>>

stop, reporting a render that panicked on the refresh thread as an error that still carries the output sink.

Trait Implementations§

Source§

impl<W: Write + Send + 'static> Drop for AutoLive<W>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<W> !RefUnwindSafe for AutoLive<W>

§

impl<W> !UnwindSafe for AutoLive<W>

§

impl<W> Freeze for AutoLive<W>

§

impl<W> Send for AutoLive<W>

§

impl<W> Sync for AutoLive<W>

§

impl<W> Unpin for AutoLive<W>

§

impl<W> UnsafeUnpin for AutoLive<W>

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.