pub struct FmtText<'k, 's> {
pub skin: &'k MadSkin,
pub lines: Vec<FmtLine<'s>>,
pub width: Option<usize>,
}
Expand description
a formatted text, implementing Display.
The text is wrapped for the width given at build, which means the rendering height is the number of lines.
use termimad::*;
let skin = MadSkin::default();
let my_markdown = "#title\n* item 1\n* item 2";
let text = FmtText::from(&skin, &my_markdown, Some(80));
println!("{}", &text);
Fields§
§skin: &'k MadSkin
§lines: Vec<FmtLine<'s>>
§width: Option<usize>
Implementations§
source§impl<'k, 's> FmtText<'k, 's>
impl<'k, 's> FmtText<'k, 's>
sourcepub fn from(
skin: &'k MadSkin,
src: &'s str,
width: Option<usize>
) -> FmtText<'k, 's>
pub fn from( skin: &'k MadSkin, src: &'s str, width: Option<usize> ) -> FmtText<'k, 's>
build a displayable text for the specified width and skin
This can be called directly or using one of the skin helper method.
Trait Implementations§
Auto Trait Implementations§
impl<'k, 's> RefUnwindSafe for FmtText<'k, 's>
impl<'k, 's> Send for FmtText<'k, 's>
impl<'k, 's> Sync for FmtText<'k, 's>
impl<'k, 's> Unpin for FmtText<'k, 's>
impl<'k, 's> UnwindSafe for FmtText<'k, 's>
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