Trait dev_bestia_html_templating::HtmlTemplatingDataTrait[][src]

pub trait HtmlTemplatingDataTrait {
    fn data_model_name(&self) -> String;
fn replace_with_string(
        &self,
        placeholder: &str,
        subtemplate_name: &str,
        row_number: usize
    ) -> String; fn replace_with_url(
        &self,
        placeholder: &str,
        _subtemplate_name: &str,
        _pos_cursor: usize
    ) -> UrlUtf8EncodedString { ... }
fn exists_next_node_or_attribute(&self, placeholder: &str) -> bool { ... }
fn replace_with_nodes(&self, placeholder: &str) -> Vec<Node> { ... }
fn process_sub_template(
        &self,
        template_name: &str,
        _sub_templates: &Vec<SubTemplate>
    ) -> Vec<Node> { ... } }
Expand description

the trait has only methods that can be implemented (overridden) It is not possible to define a method as “override forbidden” because the data model is always different and is known only to the project. if not implemented, the default functions below will be used.

Required methods

name of data model for debugging

returns a String to replace the next text-node or attribute value use macro s!() for a normal string

Provided methods

same as replace_with_string, but return url exclusively for attributes value of href and src the url must be encoded in the beginning because it encodes segments of url prior to being composed together. use macro url_u!() to create an url, very like format! I try to avoid String here to force the developer to not forget to url_encode

boolean : is the next node existing or not: “wb_” or “sb_”

returns a vector of Nodes to replace the next Node

process sub-template

Implementors