/// Render the page content and turn the page object into a template object.
Render the page content and turn the page object into a template object.
Render the page content and turn the page object into a template object .
pub fn as_template(&self) -> Result<Template, TelescopeError> {
        // Render the page content.
        let content_rendered: String = self.content.render()?;
        // Turn this object into a JSON value.
        let mut template = Template::new(Self::TEMPLATE_PATH);
        // Set the fields of the template to this object.
        template.fields = json!(&self);
        // Replace the content field with the rendered content.
        template["content"] = json!(content_rendered);
        // Return the template.
        return Ok(template);
    }
pub fn as_template ( & self ) -> Result < Template , TelescopeError > { // Render the page content. let content_rendered : String = self . content . render ( ) ? ; // Turn this object into a JSON value. let mut template = Template :: new ( Self :: TEMPLATE_PATH ) ; // Set the fields of the template to this object. template . fields = json ! ( self ) ; // Replace the content field with the rendered content. template [ " " ] = json ! ( content_rendered ) ; // Return the template. return Ok ( template ) ; }
Render the page content and turn the page object into a template object.
Render the page content and turn the page object into a template object .
&self