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, and needs the egc feature): 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.
§Examples
use retroglyph_core::{Headless, Rect, Terminal};
use retroglyph_widgets::{Align, Text, Widget};
let mut term = Terminal::new(Headless::new(10, 1));
Text::new("OK").align(Align::Right).render(Rect::new(0, 0, 10, 1), &mut term);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