pub struct Clear;
Expand description
A widget to clear/reset a certain area to allow overdrawing (e.g. for popups).
This widget cannot be used to clear the terminal on the first render as ratatui
assumes the
render area is empty. Use crate::Terminal::clear
instead.
Examples
fn draw_on_clear<B: Backend>(f: &mut Frame<B>, area: Rect) {
let block = Block::default().title("Block").borders(Borders::ALL);
f.render_widget(Clear, area); // <- this will clear/reset the area first
f.render_widget(block, area); // now render the block widget
}
Popup Example
For a more complete example how to utilize Clear
to realize popups see
the example examples/popup.rs
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Clear
impl Send for Clear
impl Sync for Clear
impl Unpin for Clear
impl UnwindSafe for Clear
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more