Skip to main content

Render

Trait Render 

Source
pub trait Render {
    // Required method
    fn render(&self) -> String;
}
Expand description

The trait that composable HTML elements should implement.

Implementers of this trait can also implement core::fmt::Display to use directly a Render in a format macro call.

An example of an HTML paragraph element:

struct PlainParagraph {
    content: String,
}

impl Render for PlainParagraph {
    fn render(&self) -> String {
        format!("<p>{}</p>", self.content)
    }
}

Required Methods§

Source

fn render(&self) -> String

Returns a String representation of the implementer.

Implementations on Foreign Types§

Source§

impl Render for String

A String returns a copy of itself when rendered

Source§

fn render(&self) -> String

Implementors§