pub struct Html { /* private fields */ }Expand description
A view that renders an HTML fragment to its area.

The standalone counterpart to attaching an
HtmlRenderer to markdown: same engine, but the whole
area is HTML. Prose wraps to the width, <pre> stays verbatim, and tables
are fitted — recomputed each frame, so one fragment covers every terminal
size.
use tuika::prelude::*;
use tuika_html::Html;
let page = Html::new("<h1>Release notes</h1><ul><li>Faster</li></ul>");
// `page` is a `View`: render it via `tuika::paint` or embed it in a `Flex`.cargo run -p tuika-html --example html_view is the scene above.
Implementations§
Source§impl Html
impl Html
Sourcepub fn new(source: impl Into<String>) -> Self
pub fn new(source: impl Into<String>) -> Self
A view over source.
Examples found in repository?
examples/html_view/main.rs (line 21)
20fn scene() -> Element {
21 let page = Boxed::new(element(Html::new(PAGE)))
22 .title(" ada.html ")
23 .padding(Padding::symmetric(2, 1));
24 let hints = KeyHints::new([("q", "quit")]);
25 view! {
26 col(padding = Padding::all(1), gap = 1) {
27 grow(1) { node(page) }
28 fixed(1) { node(hints) }
29 }
30 }
31}Trait Implementations§
Source§impl View for Html
impl View for Html
Source§fn measure(&self, available: Size, ctx: &RenderCtx<'_>) -> Size
fn measure(&self, available: Size, ctx: &RenderCtx<'_>) -> Size
Report the intrinsic content size wanted given
available and ctx.Source§fn render(&self, area: Rect, surface: &mut Surface<'_>, ctx: &RenderCtx<'_>)
fn render(&self, area: Rect, surface: &mut Surface<'_>, ctx: &RenderCtx<'_>)
Paint the view into the assigned
area through surface.Source§fn measure_request(&self, request: MeasureRequest, ctx: &RenderCtx<'_>) -> Size
fn measure_request(&self, request: MeasureRequest, ctx: &RenderCtx<'_>) -> Size
Answer a measurement request with optional known axes and intrinsic
sizing modes. Read more
Auto Trait Implementations§
impl Freeze for Html
impl RefUnwindSafe for Html
impl Send for Html
impl Sync for Html
impl Unpin for Html
impl UnsafeUnpin for Html
impl UnwindSafe for Html
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more