pub struct Fill<'a> { /* private fields */ }Expand description
A widget that fills its render area with a single repeated symbol and style.
Fill is a small building block for painting solid blocks of one symbol — backgrounds,
separators, scrollbar tracks, custom borders, etc. — without writing the nested loop
yourself. It composes naturally with the Stylize trait so the typical call site is
a one-liner.
§Examples
use ratatui::layout::Rect;
use ratatui::style::Stylize;
use ratatui::widgets::{Fill, Widget};
let fill = Fill::new("X").blue().bold();
fill.render(Rect::new(0, 0, 10, 3), &mut buf);This renders as:
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXXFill accepts anything that converts into a Cow<str>, so both string literals and
owned Strings work:
use ratatui::widgets::Fill;
let _ = Fill::new("•");
let _ = Fill::new(String::from("•"));Cells outside the buffer are silently clipped, mirroring the behavior of other widgets
such as Clear.
Implementations§
Source§impl<'a> Fill<'a>
impl<'a> Fill<'a>
Sourcepub fn new<S: Into<Cow<'a, str>>>(symbol: S) -> Self
pub fn new<S: Into<Cow<'a, str>>>(symbol: S) -> Self
Create a new Fill widget that paints symbol into every cell of its render area.
The style defaults to Style::default; use the Stylize shorthands or
Fill::style to customize it.
Trait Implementations§
impl<'a> Eq for Fill<'a>
impl<'a> StructuralPartialEq for Fill<'a>
Auto Trait Implementations§
impl<'a> Freeze for Fill<'a>
impl<'a> RefUnwindSafe for Fill<'a>
impl<'a> Send for Fill<'a>
impl<'a> Sync for Fill<'a>
impl<'a> Unpin for Fill<'a>
impl<'a> UnsafeUnpin for Fill<'a>
impl<'a> UnwindSafe for Fill<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T, U> Stylize<'_, T> for Uwhere
U: Styled<Item = T>,
impl<T, U> Stylize<'_, T> for Uwhere
U: Styled<Item = T>,
fn bg<C>(self, color: C) -> T
fn fg<C>(self, color: C) -> T
fn add_modifier(self, modifier: Modifier) -> T
fn remove_modifier(self, modifier: Modifier) -> T
fn reset(self) -> T
Source§fn on_magenta(self) -> T
fn on_magenta(self) -> T
Sets the background color to
magenta.Source§fn on_dark_gray(self) -> T
fn on_dark_gray(self) -> T
Sets the background color to
dark_gray.Source§fn on_light_red(self) -> T
fn on_light_red(self) -> T
Sets the background color to
light_red.Source§fn light_green(self) -> T
fn light_green(self) -> T
Sets the foreground color to
light_green.Source§fn on_light_green(self) -> T
fn on_light_green(self) -> T
Sets the background color to
light_green.Source§fn light_yellow(self) -> T
fn light_yellow(self) -> T
Sets the foreground color to
light_yellow.Source§fn on_light_yellow(self) -> T
fn on_light_yellow(self) -> T
Sets the background color to
light_yellow.Source§fn light_blue(self) -> T
fn light_blue(self) -> T
Sets the foreground color to
light_blue.Source§fn on_light_blue(self) -> T
fn on_light_blue(self) -> T
Sets the background color to
light_blue.Source§fn light_magenta(self) -> T
fn light_magenta(self) -> T
Sets the foreground color to
light_magenta.Source§fn on_light_magenta(self) -> T
fn on_light_magenta(self) -> T
Sets the background color to
light_magenta.Source§fn light_cyan(self) -> T
fn light_cyan(self) -> T
Sets the foreground color to
light_cyan.Source§fn on_light_cyan(self) -> T
fn on_light_cyan(self) -> T
Sets the background color to
light_cyan.Source§fn not_italic(self) -> T
fn not_italic(self) -> T
Removes the
italic modifier.Source§fn underlined(self) -> T
fn underlined(self) -> T
Adds the
underlined modifier.Source§fn not_underlined(self) -> T
fn not_underlined(self) -> T
Removes the
underlined modifier.Source§fn slow_blink(self) -> T
fn slow_blink(self) -> T
Adds the
slow_blink modifier.Source§fn not_slow_blink(self) -> T
fn not_slow_blink(self) -> T
Removes the
slow_blink modifier.Source§fn rapid_blink(self) -> T
fn rapid_blink(self) -> T
Adds the
rapid_blink modifier.Source§fn not_rapid_blink(self) -> T
fn not_rapid_blink(self) -> T
Removes the
rapid_blink modifier.Source§fn not_reversed(self) -> T
fn not_reversed(self) -> T
Removes the
reversed modifier.Adds the
hidden modifier.Removes the
hidden modifier.Source§fn crossed_out(self) -> T
fn crossed_out(self) -> T
Adds the
crossed_out modifier.Source§fn not_crossed_out(self) -> T
fn not_crossed_out(self) -> T
Removes the
crossed_out modifier.