Skip to main content

Panel

Struct Panel 

Source
pub struct Panel { /* private fields */ }
Expand description

A bordered box around a renderable. Mirrors rich.panel.Panel.

Implementations§

Source§

impl Panel

Source

pub fn new(child: Box<dyn Renderable>) -> Self

A panel around child with default box (ROUNDED) and padding (0,1).

Source

pub fn title(self, title: impl Into<String>) -> Self

Set a title (drawn into the top border, centered by default).

Source

pub fn title_align(self, align: HorizontalAlign) -> Self

Set the title alignment within the top border.

Source

pub fn subtitle(self, subtitle: impl Into<String>) -> Self

Set a subtitle (drawn into the bottom border, centered by default).

Source

pub fn subtitle_align(self, align: HorizontalAlign) -> Self

Set the subtitle alignment within the bottom border.

Source

pub fn box_set(self, box_set: BoxSet) -> Self

Choose the box-drawing set.

Source

pub fn padding(self, padding: (usize, usize, usize, usize)) -> Self

Set the inner padding (top, right, bottom, left).

Source

pub fn border_style(self, style: Style) -> Self

Set the border style.

Trait Implementations§

Source§

impl Renderable for Panel

Source§

fn rich_render( &self, console: &Console, options: &ConsoleOptions, ) -> Vec<Segment>

Source§

fn measure(&self, _console: &Console, options: &ConsoleOptions) -> Measurement

The (minimum, maximum) cell width this renderable wants. The default assumes the renderable fills the available width (e.g. Panel, Table); Text overrides it with its content width so the top-level print path can shrink to fit. Port of __rich_measure__ / Measurement.get.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Panel

§

impl !Send for Panel

§

impl !Sync for Panel

§

impl !UnwindSafe for Panel

§

impl Freeze for Panel

§

impl Unpin for Panel

§

impl UnsafeUnpin for Panel

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.