pub struct Renderer<D: TextDecorator + Clone, C: Converter<D::Annotation>> { /* private fields */ }Expand description
A renderer for HTML documents.
This renderer uses html2text to parse and render an HTML document. The provided document
is only parsed once: when the instance is constructed. Then it is rendered every time the
width of the view changes.
You can custommize the renderer by settting a custom TextDecorator and Converter.
The TextDecorator is used by html2text to convert the HTML DOM into annotated
strings. The Converter is used by the renderer to interpret the annotations and to
extract the text format and links.
Per default, the renderer uses the RichDecorator and the RichConverter.
Implementations§
Source§impl Renderer<RichDecorator, RichConverter>
impl Renderer<RichDecorator, RichConverter>
Sourcepub fn new(html: &str) -> Renderer<RichDecorator, RichConverter>
pub fn new(html: &str) -> Renderer<RichDecorator, RichConverter>
Creates a new renderer for the given HTML document using the default settings.
Trait Implementations§
Source§impl<D: TextDecorator + Clone, C: Converter<D::Annotation>> Renderer for Renderer<D, C>
impl<D: TextDecorator + Clone, C: Converter<D::Annotation>> Renderer for Renderer<D, C>
Auto Trait Implementations§
impl<D, C> !Freeze for Renderer<D, C>
impl<D, C> !RefUnwindSafe for Renderer<D, C>
impl<D, C> Send for Renderer<D, C>
impl<D, C> !Sync for Renderer<D, C>
impl<D, C> Unpin for Renderer<D, C>
impl<D, C> UnwindSafe for Renderer<D, C>where
D: UnwindSafe,
C: UnwindSafe,
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