pub struct Text<'a> { /* private fields */ }Expand description
A single line of text in one Style, clipped (not wrapped) to
area.width() columns. Only the first row of area is used.
The plain-content cousin of PrintLine (which
prints a multi-span Line, for mixed
styling within one line) and Paragraph (which
word-wraps across multiple lines): reach
for Text for a single already-one-line label or readout in a single
style, with no wrapping and no per-span styling. style defaults to
Style::new() and align to Align::Left; set them with
Text::style/Text::align.
Unlike super::BoxBorder, super::Gauge, super::StatBar,
super::Table, and super::Button, Text has no theme()/
theme_on() pair: a line of plain text has no single semantic
Theme role to map onto, so callers set style directly.
§Examples
use retroglyph_core::grid::{Grid, Rect};
use retroglyph_ui::{Align, Surface, Text, Widget};
let area = Rect::new(0, 0, 10, 1);
let mut grid = Grid::new(10, 1);
Text::new("OK")
.align(Align::Right)
.render(&mut Surface::new(&mut grid, area, 0));Implementations§
Trait Implementations§
impl<'a> Copy for Text<'a>
Auto Trait Implementations§
impl<'a> Freeze for Text<'a>
impl<'a> RefUnwindSafe for Text<'a>
impl<'a> Send for Text<'a>
impl<'a> Sync for Text<'a>
impl<'a> Unpin for Text<'a>
impl<'a> UnsafeUnpin for Text<'a>
impl<'a> UnwindSafe for Text<'a>
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,
§impl<C> WithAlpha for Cwhere
C: Copy,
impl<C> WithAlpha for Cwhere
C: Copy,
§fn with_alpha_first<A>(self, alpha: A) -> AlphaFirst<A, Self>
fn with_alpha_first<A>(self, alpha: A) -> AlphaFirst<A, Self>
Wraps
self with alpha, storing alpha before the color in memory
(see [AlphaFirst]).§fn with_alpha_last<A>(self, alpha: A) -> AlphaLast<A, Self>
fn with_alpha_last<A>(self, alpha: A) -> AlphaLast<A, Self>
Wraps
self with alpha, storing alpha after the color in memory
(see [AlphaLast]).