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
impl Padding
Sourcepub fn new(
child: Box<dyn Renderable>,
pad: (usize, usize, usize, usize),
) -> Self
pub fn new( child: Box<dyn Renderable>, pad: (usize, usize, usize, usize), ) -> Self
Pad child by an explicit (top, right, bottom, left).
Sourcepub fn uniform(child: Box<dyn Renderable>, amount: usize) -> Self
pub fn uniform(child: Box<dyn Renderable>, amount: usize) -> Self
Equal padding on all four sides.
Trait Implementations§
Source§impl Renderable for Padding
impl Renderable for Padding
Source§fn measure(&self, console: &Console, options: &ConsoleOptions) -> Measurement
fn measure(&self, console: &Console, options: &ConsoleOptions) -> Measurement
Port of Padding.__rich_measure__: the child’s measurement plus the
horizontal padding, or the whole width when the padding leaves no room.
fn rich_render( &self, console: &Console, options: &ConsoleOptions, ) -> Vec<Segment>
Source§fn fit_to_measurement(&self) -> bool
fn fit_to_measurement(&self) -> bool
Whether a top-level
Console::print shrinks this renderable to its
measured width. Upstream renders every top-level renderable at the full
console width, so the default is false; an extension may opt in.Auto Trait Implementations§
impl !RefUnwindSafe for Padding
impl !Send for Padding
impl !Sync for Padding
impl !UnwindSafe for Padding
impl Freeze for Padding
impl Unpin for Padding
impl UnsafeUnpin for Padding
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