pub struct Padding {
pub content: Text,
pub top: usize,
pub right: usize,
pub bottom: usize,
pub left: usize,
pub style: Style,
pub expand: bool,
}Expand description
A renderable that adds whitespace padding around Text content.
Fields§
§content: TextThe inner content to pad.
top: usizeTop padding (blank lines above content).
right: usizeRight padding (spaces after each content line).
bottom: usizeBottom padding (blank lines below content).
left: usizeLeft padding (spaces before each content line).
style: StyleStyle applied to the padding whitespace.
expand: boolIf true, expand to fill the available width.
Implementations§
Source§impl Padding
impl Padding
Sourcepub fn wrap(content: Text, pad: impl Into<PaddingDimensions>) -> Self
pub fn wrap(content: Text, pad: impl Into<PaddingDimensions>) -> Self
Wrap content in padding with default style and expand: true.
pad accepts usize (uniform), (v, h), or (t, r, b, l). For
styled padding background or expand: false, use new.
let p = Padding::wrap(Text::new("Hello", Style::null()), (2, 4));Sourcepub fn new(
content: Text,
pad: PaddingDimensions,
style: Style,
expand: bool,
) -> Self
pub fn new( content: Text, pad: PaddingDimensions, style: Style, expand: bool, ) -> Self
Create a new Padding around the given content.
Sourcepub fn indent(content: Text, level: usize) -> Self
pub fn indent(content: Text, level: usize) -> Self
Convenience: create padding that acts as a left-indent.
Sourcepub fn measure(
&self,
_console: &Console,
options: &ConsoleOptions,
) -> Measurement
pub fn measure( &self, _console: &Console, options: &ConsoleOptions, ) -> Measurement
Measure the minimum and maximum width requirements.
Trait Implementations§
Source§impl Renderable for Padding
impl Renderable for Padding
Source§fn gilt_console(
&self,
console: &Console,
options: &ConsoleOptions,
) -> Vec<Segment>
fn gilt_console( &self, console: &Console, options: &ConsoleOptions, ) -> Vec<Segment>
Produce segments for rendering on the given console with given options.
Auto Trait Implementations§
impl !Freeze for Padding
impl RefUnwindSafe for Padding
impl Send for Padding
impl Sync for Padding
impl Unpin for Padding
impl UnsafeUnpin for Padding
impl UnwindSafe 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> RenderableExt for Twhere
T: Renderable + 'static,
impl<T> RenderableExt for Twhere
T: Renderable + 'static,
Source§fn into_boxed_renderable(self) -> RenderableBox
fn into_boxed_renderable(self) -> RenderableBox
Convert this renderable into a
RenderableBox for type-erased storage. Read more