Skip to main content

Padding

Struct Padding 

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

Blank space around a child renderable. Mirrors rich.padding.Padding.

The pad is (top, right, bottom, left) — the same order as CSS and upstream.

Implementations§

Source§

impl Padding

Source

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

Pad child by an explicit (top, right, bottom, left).

Source

pub fn uniform(child: Box<dyn Renderable>, amount: usize) -> Self

Equal padding on all four sides.

Source

pub fn symmetric( child: Box<dyn Renderable>, vertical: usize, horizontal: usize, ) -> Self

(vertical, horizontal) padding (top==bottom, left==right).

Source

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

Set the style applied to the padding (and blank lines).

Trait Implementations§

Source§

impl Renderable for Padding

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§

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.