Struct liveterm::TermPrinter [−][src]
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]
W: RefUnwindSafe,
impl<W> Send for TermPrinter<W> where
W: Send,
[src]
W: Send,
impl<W> Sync for TermPrinter<W> where
W: Sync,
[src]
W: Sync,
impl<W> Unpin for TermPrinter<W> where
W: Unpin,
[src]
W: Unpin,
impl<W> UnwindSafe for TermPrinter<W> where
W: UnwindSafe,
[src]
W: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,