Trait Template

Source
pub trait Template {
    type Data;

    // Required methods
    fn new(router: SharedRouter) -> Self;
    fn router(&self) -> SharedRouter;
    fn body(&self, data: Self::Data) -> String;

    // Provided methods
    fn render(&self, data: Self::Data) { ... }
    fn render_html(&self, html: &str) { ... }
    fn register_forms(&self) { ... }
    fn get_document(&self) -> Option<Document> { ... }
    fn get_all_forms(&self, doc: &Document) -> Option<NodeList> { ... }
    fn reset_form(&self, form_node: Node) -> Option<HtmlFormElement> { ... }
    fn attach_form_listener(&self, form: &HtmlFormElement) { ... }
}

Required Associated Types§

Required Methods§

Source

fn new(router: SharedRouter) -> Self

Source

fn router(&self) -> SharedRouter

Source

fn body(&self, data: Self::Data) -> String

Provided Methods§

Source

fn render(&self, data: Self::Data)

Source

fn render_html(&self, html: &str)

Source

fn register_forms(&self)

Source

fn get_document(&self) -> Option<Document>

Source

fn get_all_forms(&self, doc: &Document) -> Option<NodeList>

Source

fn reset_form(&self, form_node: Node) -> Option<HtmlFormElement>

Source

fn attach_form_listener(&self, form: &HtmlFormElement)

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.

Implementors§