pub struct Paragraph<'a> { /* private fields */ }Available on crate feature
egc only.Expand description
Word-wrapped text in a single Style.
Paragraph::new(text) wraps text to whatever width it is rendered at
(via Widget::render), or reports the height it would need at a
given width without rendering (via Measure::height_for) so a caller
can size its pane to fit instead of guessing a fixed height. style
defaults to Style::new(); set it with Paragraph::style.
§Examples
use retroglyph_core::{Grid, Rect};
use retroglyph_widgets::{Measure, Paragraph, Surface, Widget};
let p = Paragraph::new("the quick brown fox jumps");
let height = p.height_for(10); // rows needed to wrap at 10 columns
let area = Rect::new(0, 0, 10, height);
let mut grid = Grid::new(10, height);
p.render(area, &mut Surface::new(&mut grid, area, 0));Implementations§
Trait Implementations§
impl<'a> Copy for Paragraph<'a>
Auto Trait Implementations§
impl<'a> Freeze for Paragraph<'a>
impl<'a> RefUnwindSafe for Paragraph<'a>
impl<'a> Send for Paragraph<'a>
impl<'a> Sync for Paragraph<'a>
impl<'a> Unpin for Paragraph<'a>
impl<'a> UnsafeUnpin for Paragraph<'a>
impl<'a> UnwindSafe for Paragraph<'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