Skip to main content

KnownSize

Trait KnownSize 

Source
pub trait KnownSize {
    // Required methods
    fn width(&self) -> usize;
    fn height(&self) -> usize;
}
Expand description

A trait for widgets that have a fixed size.

This trait allows the popup to automatically size itself based on the size of the body widget. Implementing this trait for a widget allows it to be used as the body of a popup. You can also wrap existing widgets in a newtype and implement this trait for the newtype to use them as the body of a popup.

This trait was previously called SizedWidgetRef, but was renamed to KnownSize to avoid confusion with the WidgetRef trait from ratatui.

Required Methods§

Source

fn width(&self) -> usize

Source

fn height(&self) -> usize

Implementations on Foreign Types§

Source§

impl KnownSize for &str

Source§

fn width(&self) -> usize

Source§

fn height(&self) -> usize

Source§

impl KnownSize for &Text<'_>

Source§

fn width(&self) -> usize

Source§

fn height(&self) -> usize

Source§

impl KnownSize for String

Source§

fn width(&self) -> usize

Source§

fn height(&self) -> usize

Source§

impl KnownSize for Text<'_>

Source§

fn width(&self) -> usize

Source§

fn height(&self) -> usize

Implementors§