pub struct Align { /* private fields */ }Expand description
Aligns a child renderable within the available width (and, with a
vertical alignment, height). Mirrors rich.align.Align.
Implementations§
Source§impl Align
impl Align
Sourcepub fn new(child: Box<dyn Renderable>, align: HorizontalAlign) -> Self
pub fn new(child: Box<dyn Renderable>, align: HorizontalAlign) -> Self
Align child horizontally. Port of Align(renderable, align); the
other keywords are builder methods.
Sourcepub fn left(child: Box<dyn Renderable>) -> Self
pub fn left(child: Box<dyn Renderable>) -> Self
Left-align the child (pads on the right).
Sourcepub fn center(child: Box<dyn Renderable>) -> Self
pub fn center(child: Box<dyn Renderable>) -> Self
Center the child (pads both sides, extra cell on the right).
Sourcepub fn right(child: Box<dyn Renderable>) -> Self
pub fn right(child: Box<dyn Renderable>) -> Self
Right-align the child (pads on the left).
Sourcepub fn style(self, style: Style) -> Self
pub fn style(self, style: Style) -> Self
The background style of the padding (upstream style=), applied under
the whole output.
Sourcepub fn vertical(self, vertical: VerticalAlign) -> Self
pub fn vertical(self, vertical: VerticalAlign) -> Self
Align vertically within height (or the options’ height). Upstream
vertical=.
Source§impl Align
impl Align
Sourcepub fn render_child(
child: &dyn Renderable,
align: HorizontalAlign,
console: &Console,
options: &ConsoleOptions,
) -> Vec<Segment>
pub fn render_child( child: &dyn Renderable, align: HorizontalAlign, console: &Console, options: &ConsoleOptions, ) -> Vec<Segment>
Align.__rich_console__ over a borrowed child: what
Console::print_with wraps a non-Text renderable in for
justify="left"|"center"|"right" (upstream’s _collect_renderables).
Trait Implementations§
Source§impl Renderable for Align
impl Renderable for Align
Source§fn measure(&self, console: &Console, options: &ConsoleOptions) -> Measurement
fn measure(&self, console: &Console, options: &ConsoleOptions) -> Measurement
Port of Align.__rich_measure__: the child’s measurement.
Source§fn vertical(&self) -> Option<VerticalAlign>
fn vertical(&self) -> Option<VerticalAlign>
Upstream’s Align.vertical, which a Table cell aligns by.
fn rich_render( &self, console: &Console, options: &ConsoleOptions, ) -> Vec<Segment>
Source§fn fit_to_measurement(&self) -> bool
fn fit_to_measurement(&self) -> bool
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.