Struct liveterm::TermPrinter[][src]

pub struct TermPrinter<W> {
    pub buf: String,
    // some fields omitted
}

Wraps stdout, allowing you to clear stuff you previously wrote.

Fields

buf: String

Write the stuff you want to print/clear into this buffer.

Implementations

impl<W: Write> TermPrinter<W>[src]

pub fn new(wtr: W) -> TermPrinter<W>[src]

pub fn clear(&mut self) -> Result<(), Error>[src]

Clear the lines we wrote previously.

Make sure buf still has the same contents as the last time you called TermPrinter::print().

Note that in some cases this is impossible: for instance, if we print N lines and then the user resizes the terminal to something less than N, those lines will end up in the scrollback buffer - there's nothing we can do about that (without switching to the alternate screen).

pub fn print(&mut self) -> Result<(), Error>[src]

Print the visible tail of buf to wtr.

Stuff that scrolls off the top of the terminal end up in the scrollback buffer, where we can't clear it. Therefore this method will only write as many lines as the terminal currently has room for.

pub fn print_all(mut self: Self) -> Result<(), Error>[src]

Print all of buf to wtr.

After this we can't reliably clear what we've written (since it may have gone off the top of the screen). Hence, this method drops the TermPrinter.

Auto Trait Implementations

impl<W> RefUnwindSafe for TermPrinter<W> where
    W: RefUnwindSafe
[src]

impl<W> Send for TermPrinter<W> where
    W: Send
[src]

impl<W> Sync for TermPrinter<W> where
    W: Sync
[src]

impl<W> Unpin for TermPrinter<W> where
    W: Unpin
[src]

impl<W> UnwindSafe for TermPrinter<W> where
    W: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.