Trait Render

Source
pub trait Render: Sized {
    // Required method
    fn render_into<W: Write>(self, writer: &mut W) -> Result;

    // Provided method
    fn render(self) -> String { ... }
}
Expand description

Render a component

This is the underlying mechanism of the #[component] macro

Required Methods§

Source

fn render_into<W: Write>(self, writer: &mut W) -> Result

Render the component to a writer. Make sure you escape html correctly using the render::html_escaping module

Provided Methods§

Source

fn render(self) -> String

Render the component to string

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Render for &str

Source§

fn render_into<W: Write>(self, writer: &mut W) -> Result

Source§

impl Render for ()

Does nothing

Source§

fn render_into<W: Write>(self, _writer: &mut W) -> Result

Source§

impl Render for String

Source§

fn render_into<W: Write>(self, writer: &mut W) -> Result

Source§

impl<A: Render, B: Render> Render for (A, B)

Renders A, then B

Source§

fn render_into<W: Write>(self, writer: &mut W) -> Result

Source§

impl<A: Render, B: Render, C: Render> Render for (A, B, C)

Renders A, then B, then C

Source§

fn render_into<W: Write>(self, writer: &mut W) -> Result

Source§

impl<O: Render, E: Render> Render for Result<O, E>

Renders O or E

Source§

fn render_into<W: Write>(self, writer: &mut W) -> Result

Source§

impl<T: Render> Render for Option<T>

Renders T or nothing

Source§

fn render_into<W: Write>(self, writer: &mut W) -> Result

Implementors§

Source§

impl Render for HTML5Doctype

Source§

impl<'s> Render for Raw<'s>

A raw (unencoded) html string

Source§

impl<T: Render> Render for Fragment<T>

Source§

impl<T: Render> Render for SimpleElement<'_, T>