rshtml_core 0.2.0

RsHtml: A Template Engine for Seamless HTML and Rust Integration.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::compiler::Compiler;
use anyhow::Result;
use proc_macro2::TokenStream;
use quote::quote;
use std::ops::AddAssign;

pub struct TextCompiler;

impl TextCompiler {
    pub fn compile(compiler: &mut Compiler, text: &String) -> Result<TokenStream> {
        compiler.text_size.add_assign(text.len());
        Ok(quote! { write!(__f__, "{}", #text)?; })
    }
}