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
use ratatui::{prelude::*, widgets::*};
fn draw_on_clear(f: &mut Frame, 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§
source§impl PartialEq for Clear
impl PartialEq for Clear
impl Eq for Clear
impl StructuralEq for Clear
impl StructuralPartialEq for Clear
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more